由于几天,我的应用程序无法发送SMTP电子邮件。 这个应用程序实际上是一个计划任务(在本地机器上运行,使用SmtpClient用C#编写),偶尔需要发送一个(或几个)电子邮件。 代码与此类似:
var smtpClient = new SmtpClient(); var mailMessage = new MailMessage( from, // account in my domain to, subject, body) { IsBodyHtml = true }; smtpClient.Send(mailMessage);
以下是我的app.config文件中的相关configuration部分:
<system.net> <mailSettings> <smtp deliveryMethod="Network"> <network enableSsl="true" port="587" userName="[email protected]" password="********" host="smtp.office365.com"> </network> </smtp> </mailSettings> </system.net>
注意
什么可能导致这个问题? 是否有任何logging或其他诊断,我可以打开找出更多的信息?