【发布时间】:2014-08-25 14:59:31
【问题描述】:
我有以下似乎不起作用的代码。错误信息在代码下方。
Dim smtpserver As New SmtpClient()
Dim mail As New MailMessage()
smtpserver.Credentials = New Net.NetworkCredential("myemail@gmail.com", "mypassword")
smtpserver.Port = 465
smtpserver.Host = "smtp.gmail.com"
mail = New MailMessage()
mail.From = New MailAddress("myemail")
mail.To.Add("myemail@gmail.com")
mail.Subject = "Test"
mail.Body = "testing "
smtpserver.Send(mail)
MsgBox("Mail Sent")
这是错误信息:
The SMTP server requires a secure connection or the client was not authenticated.
The server response was:
5.7.0 Must issue a STARTTLS command first.
w6sm4604909qas.26 - gsmtp
这是什么意思?为什么这不起作用?
【问题讨论】:
-
鉴于您的代码通常是电子邮件链中最小的部分,因此无法回答您的“问题”。您的代码可能是完美的,但您的电子邮件正在被其他一些系统扔进垃圾邮件中。
-
您遇到什么错误?添加错误检查代码(阅读文档,他们应该说明如何)以找出答案。然后在问题中添加错误信息。