-1
我已經使用此代碼發送電子郵件。當我測試在LOCALHOST這個代碼,它工作正常,但在主機上,我得到這個錯誤:電子郵件不發送使用主機上的Gmail smtp
Failure sending mail.few
我的代碼是:
Dim MailMsg As New MailMessage(New Net.Mail.MailAddress("[email protected]"), New Net.Mail.MailAddress("[email protected]"))
MailMsg.Subject = "test"
MailMsg.Body = "test"
MailMsg.IsBodyHtml = True
Dim SmtpMail As New Net.Mail.SmtpClient
Dim SMTPUserInfo As New Net.NetworkCredential()
SMTPUserInfo.UserName = "MYUSERNAME"
SMTPUserInfo.Password = "MYPASSWORD"
SmtpMail.UseDefaultCredentials = False
SmtpMail.Credentials = SMTPUserInfo
SmtpMail.Host = "smtp.gmail.com"
SmtpMail.Port = 587
SmtpMail.EnableSsl = True
SmtpMail.Send(MailMsg)
也許Gmail會阻止你..通過其他檢查服務器 – Itiel
我已經使用了2個Gmail帳戶,但問題仍然存在 – Mohammad
端口是否打開? – WozzeC