【发布时间】:2014-10-02 04:10:36
【问题描述】:
如何使用outlook地址在ASP .Net上发送电子邮件??
我试过这段代码但没有运气:
Dim mailMessage As System.Net.Mail.MailMessage = New System.Net.Mail.MailMessage()
mailMessage.From = New System.Net.Mail.MailAddress("fromAddress")
mailMessage.To.Add(New System.Net.Mail.MailAddress("toAddress"))
mailMessage.Priority = Net.Mail.MailPriority.High
mailMessage.Subject = "Subject"
mailMessage.Body = "test"
Dim smtpClient As System.Net.Mail.SmtpClient = New System.Net.Mail.SmtpClient("xxx.outlook.com", portNumber)
smtpClient.Send(mailMessage) //--> got error here
但是当我执行代码时,它得到了这个错误信息:
The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.1 Client was not authenticated
我尝试添加一行代码:
smtpClient.Credentials = 新 System.Net.NetworkCredential(用户名、密码)
但还是发不了邮件。
有人可以帮忙吗?
【问题讨论】: