我正在运行Windows Server 2008 R2,但正在收到smtp邮件异常:
信箱不可用。服务器响应为:访问被拒绝-无效的HELO名称(请参阅RFC2821 4.1.1.1)
代码隐藏:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim NewMail As New System.Net.Mail.MailMessage
Dim str1 As String = String.Empty
str1 = Convert.ToString(System.Configuration.ConfigurationManager.AppSettings("SmtpEmail")) '[email protected]
Dim fromaddress As MailAddress = New MailAddress(str1)
NewMail.From = fromaddress
NewMail.Sender = fromaddress
NewMail.IsBodyHtml = True
NewMail.Subject = "TEST"
NewMail.Body = "This is Testing..."
NewMail.Priority = System.Net.Mail.MailPriority.Normal
NewMail.To.Add("[email protected]")
Dim SmtpMail As New SmtpClient()
SmtpMail.Port = 25
SmtpMail.Host = ConfigurationManager.AppSettings("SmtpServer").ToString 'mail.xyz.com
SmtpMail.Send(NewMail)
NewMail.Dispose()
SmtpMail.Dispose()
End Sub
最佳答案
用户名或密码必须不正确,请尝试使用其他用户名和密码并将其 checkout 。}
还要验证要连接的端口(eg. 587
)