即時發送電子郵件時遇到錯誤。這裏是錯誤失敗發送電子郵件無法連接遠程服務器
什麼是此異常的實際錯誤,因爲我在這個新手中,這裏的方式是我的代碼行:
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