使用Net.Mail.SmtpClient发送时出现HELO错误

时间:2014-10-20 12:48:35

标签: vb.net email smtp

当我尝试使用Net.Mail.SmtpClient发送简单的电子邮件时出现错误

  

邮箱不可用。服务器响应是:访问被拒绝 - 无效   HELO名称(见RFC2821 4.1.1.1)

奇怪的是,它可以在我的家用电脑上运行,但不适用于办公室电脑。

问题出在哪里或什么地方?

代码是用VB.NET(.NET Framework 2.0)编写的:

Dim sendMail As New SmtpClient("mail.myhost.com", 25)
sendMail.UseDefaultCredentials = False
sendMail.Credentials = New Net.NetworkCredential("user@myhost.com", "123")
sendMail = New Net.Mail.SmtpClient("mail.myhost.com", 25)
Dim mail As New MailMessage()
mail.From = New MailAddress("user@myhost.com", "Jack SMITH")
Dim maTO As MailAddress = New MailAddress("someone@gmail.com", "John DOE")
mail.To.Add(maTO)
mail.Subject = "The mail subject"
mail.Body = "The mail body"
mail.IsBodyHtml = False
sendMail.Send(mail)
mail.Dispose()

0 个答案:

没有答案