即时发送电子邮件时遇到错误。这里是错误失败发送电子邮件无法连接远程服务器
什么是此异常的实际错误,因为我在这个新手中,这里的方式是我的代码行:
Try
Dim SmtpServer As New SmtpClient()
Dim mail As New MailMessage()
SmtpServer.Credentials = New _
Net.NetworkCredential("[email protected]", "passwordexample")
SmtpServer.EnableSsl = True
SmtpServer.Port = 587
SmtpServer.Host = "smtp.gmail.com"
mail = New MailMessage()
mail.From = New MailAddress("[email protected]")
mail.To.Add("[email protected]")
mail.Subject = "Change Request Submitted"
mail.Body = "Dear User, " & Environment.NewLine & Environment.NewLine & Environment.NewLine & Environment.NewLine & "One Notification have been submitted," & Environment.NewLine & "Please check the change request on the intranet application"
//ad this line the error SmtpServer.Send(mail)
SmtpServer.EnableSsl = True
MsgBox("Notification emailed successfully")
Catch ex As Exception
MsgBox(ex.ToString)
End Try
做你的互联网服务提供商允许您发送的邮件? SMTP通常被阻止。 – jgauffin
@jgauffin她似乎在使用GMail。它可以是两步验证,也可以不通过她的帐户启用POP或IMAP。 – Codexer