我无法通过smtp.gmail.com向仅一个特定的Google帐户发送邮件。当我使用其他Google帐户时,我的VBS脚本会成功发送邮件,因此我知道该脚本工作正常。
该特定帐户似乎存在问题,我已在Gmail帮助论坛中发布了支持请求。
https://productforums.google.com/forum/#!topic/gmail/8XFKONFbDA8
我的VBS脚本:
Dim emailObj
Set emailObj = CreateObject("CDO.Message")
emailObj.From = "******@gmail.com"
emailObj.To = "******@gmail.com"
emailObj.Subject = "Test Email"
emailObj.TextBody = "Testing Email Functionality"
Set emailConfig = emailObj.Configuration
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = true
'First Account
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = "******@gmail.com"
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "************"
'Second Account
'emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = "******@gmail.com"
'emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "************"
emailConfig.Fields.Update
emailObj.Send
If err.number = 0 Then
Msgbox "Done"
Else
Msgbox err
End If
帐户1测试(不工作)
帐户2测试(工作)
错误消息:无法将消息发送到SMTP服务器。传输错误代码是0x80040217。服务器响应不可用
任何帮助将不胜感激。
答案 0 :(得分:0)
我有同样的错误。 Google帐户中有一个选项 - https://myaccount.google.com/lesssecureapps。我打开它,它帮助了我。