我正在尝试使用Outlook.com smtp支持发送自动电子邮件.但是我得到以下异常:
System.Net.Mail.SmtpException: Failure sending mail.
---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host" Exception while sending email.
Run Code Online (Sandbox Code Playgroud)
我的代码:
public bool SendEmail(MailMessage msg)
{
try
{
SmtpClient smtpClient = new SmtpClient("smtp-mail.outlook.com")
{
UseDefaultCredentials = false,
DeliveryMethod = SmtpDeliveryMethod.Network,
Credentials = new NetworkCredential("userAddress", "userPassword"),
Port = 587,
EnableSsl = true,
};
smtpClient.Send(msg);
msg.Dispose();
smtpClient.Dispose();
return true;
} …
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 MailKit 通过我的 Outlook.com 电子邮件地址发送电子邮件。
我遵循了我在网上看到的所有示例,这就是我所拥有的:
public async Task SendEmailAsync(string email, string subject, string htmlmessage)
{
var message = new MimeMessage();
message.From.Add(new MailboxAddress("Service Account", "me@outlook.com"));
message.To.Add(new MailboxAddress("First Last", email));
message.Subject = subject;
message.Body = new TextPart(TextFormat.Html)
{
Text = htmlMessage
};
using (var client = new SmtpClient())
{
//Have tried both false and true
client.Connect("smtp-mail.outlook.com", 587, false);
client.AuthenticationMechanisms.Remove("XOAUTH2");
client.Authenticate("me@outlook.com", "mypassword");
await client.SendAsync(message);
client.Disconnect(true);
}
return;
}
Run Code Online (Sandbox Code Playgroud)
如果我将useSSL
参数设置为true
on client.Connect()
,则会出现此错误:
An error occurred while attempting to establish …
Run Code Online (Sandbox Code Playgroud) 我想在我们的 Web 应用程序中发布日历,以便客户可以使用他们最喜欢的软件(Google 日历、Outlook.com 等)订阅它。
\n我从数据库中提取数据并使用 sabre/dav 的 VObject 类创建一个 ics 文件,然后通过 url 提供它:
\n\n\nwebcal://www.server.com/calendar.php?username=john.doe&cal_id=efccd95ee22917d327e31840fbc1a97936a4
\n
这适用于 Google Calendar 和 Thunderbird,但不适用于 Outlook.com,后者显然尝试执行一些涉及 Oauth 2 的“现代身份验证”(是的,这就是它的名称)。没有错误,但也没有事件。我假设这就是阻止它工作的原因:
\n\n\nhttps://support.microsoft.com/en-gb/help/4025591/you-can-t-add-an-internet-calendar-in-outlook
\n
据我所知,这不是同步间隔问题,因为:
\n有人提出了类似的问题,但没有给出答案:
\n\n\n\n
我捕获了 Outlook 发送到我的服务器的 HTTP 请求标头,除了用户代理“Exchange”之外,它是一个标准请求,没有额外的标头。
\nMicrosoft 似乎没有准确记录 Outlook 365 的预期。
\n有一种解决方法说订阅时使用 OWA (Outlook Web Access),我认为这只适用于企业客户。
\n以下是我的服务器的响应。
\n卷曲输出:
\n< HTTP/1.1 200 …
Run Code Online (Sandbox Code Playgroud) 我有一个有趣的问题,似乎无法解决。
Chrome和FireFox添加了默认样式,margin-block-start:1em; margin-block-end:1em;
Safari添加margin-before:1em; margin-after:1em;
了段落和标题元素。这导致段落之间以及标题及其关联副本之间的空间超出了预期。
我能够添加一个重置,该重置可用于直接在浏览器中查看HTML。但是,这种重置无法在Outlook.com,Office 365和Gmail上实现。这些Webmail客户端似乎不支持这些CSS属性,并且正在将它们过滤掉。
到目前为止,这是我尝试使用的方法:
p, h1, h2, h3, h3, h4, h4 {
margin-block-start:0px;
margin-block-end:0px;
margin-inline-start:0px;
margin-inline-end:0px;
-webkit-margin-before:0px;
-webkit-margin-after:0px;
margin-before:0px;
margin-after:0px;
}
Run Code Online (Sandbox Code Playgroud)
这种CSS样式没有使其成为电子邮件客户端上的样式标签。例如,Outlook.com将方括号显示为空,其中没有任何属性。因此,不会进行全局重置,并且浏览器将应用1em的值。
有人找到解决此问题的方法了吗?设置边距和填充属性似乎不会覆盖边距块。
我正在使用Office365 REST API来获取有关我的联系人的详细信息,但我注意到响应中没有关于用户个人资料图片的信息.
我想我需要以其他方式检索,但我无法弄清楚如何.
有什么建议吗?
我正在处理一封电子邮件,该邮件<p>
在hotmail中的标签之间存在间距问题.我用了
.ExternalClass, .ExternalClass p, .ExternalClass span,
.ExternalClass font, .ExternalClass td, .ExternalClass div {line-height: 100%;}
Run Code Online (Sandbox Code Playgroud)
但看起来Hotmail已经改变了他们的CSS结构.
我检查了文件,并且调用了一个外部CSS,它控制段落格式并剥离头部中的任何内联样式或样式,特别是控制边距<p>
.这个CSS全局给出1.35em的段落边距,但我希望它是.5em.
任何建议将被认真考虑.谢谢.
把我的生活变成碎片,这是我的最后一招.
说真的,我无法在任何地方找到这些信息!我认为Graph支持Outlook.com.我看到这个引用Outlook Api和Graph Api的问题,但是如何为此授权Outlook.com帐户呢?
我正在向用户发送https://login.microsoftonline.com/common/oauth2/authorize
参数:
response_type = code
client_id = <my client id>
redirect_uri = <my redirect_uri>
state = <csrf>
resource = https://outlook.office.com/
Run Code Online (Sandbox Code Playgroud)
登录.它@outlook.com
会将它们带到Office 365登录,当您键入时,它会尝试重定向您,只返回365登录页面并全部执行.
我可以很好地授权Office 365,但不能Outlook.com.如果需要,我可以提供更多信息,我只是觉得我遇到了错误的端点或其他什么.
Outlook.com是否支持EWS?如果不是,使用python访问用户任务和日历的不同方式是什么?
到目前为止,我已经执行了以下操作:
使用EWSWrapper并尝试将suds -ews与python一起使用。当我尝试使用outlook.com帐户时,所有这些实施都会失败。
所以这是我想知道的:
任何帮助表示赞赏。
众所周知,Outlook.com 正在接管 Hotmail。电子邮件模板中的 HTML 表单和输入字段不再适用于 Outlook.com。问题包括:
在 Outlook.com 的电子邮件模板中解决此问题的最佳解决方案是什么?
outlook.com ×9
email ×4
css ×2
asp.net-core ×1
c# ×1
gmail ×1
hotmail ×1
html ×1
html-email ×1
mailkit ×1
office365 ×1
office365api ×1
outlook ×1
rest ×1
smtp-auth ×1
smtpclient ×1
webcal ×1