我在Exchange Online服务上有一个邮件帐户。现在,我想测试,如果我能够通过C#应用程序发送邮件给客户(在varoius域和微软的Office 365)在.net中发送测试Microsoft Office 365的SMTP电子邮件
我试图执行下面的代码,但我得到的错误
“根据验证 过程,远程证书无效。”
MailMessage mail = null;
mail = new MailMessage();
string[] strToList = "[email protected]"
foreach (string strID in strToList)
{
if (strID != null)
{
mail.To.Add(new MailAddress(strID));
}
}
mail.From = "[email protected]";
mail.Subject = "testing"
mail.IsBodyHtml = true;
mail.Body = "mail body";
SmtpClient client = new SmtpClient("smtp.outlook.office365.com");
client.Port = 587;
client.EnableSsl = true;
client.UseDefaultCredentials = false;
NetworkCredential cred = new System.Net.NetworkCredential("[email protected]", "mypassword");
client.Credentials = cred;
client.Send(mail);
请指教,如果我做错了什么。 非常感谢。
[发送使用Smtp.mail.microsoftonline.com电子邮件]的可能重复(http://stackoverflow.com/questions/6656039/sending-email-using-smtp-mail-microsoftonline-com) – bubbassauro 2013-08-05 16:16:35
HTTP ://www.softdeveloperszone.com/2013/04/send-email-through-office-365-outlook.html。在这一个有一个裂缝。为我工作 – chamara 2016-11-13 09:04:55