Cannot send mail using smtp.gmail.com from ONLY one specific Google account

1

I am not able to send mail via smtp.gmail.com for ONLY one specific Google account. When I use another Google account my VBS script sends mail successfully so I know the script is working correctly.

It looks like there is an issue with that particular account and I have already posted a request for support in the Gmail help forums.

https://productforums.google.com/forum/#!topic/gmail/8XFKONFbDA8

My VBS Script:

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

Account 1 Test (Not Working)

Account 1

Account 2 Test (Working)

Account 2

Error Message: The message could not be sent to the SMTP server. The transport error code was 0x80040217. The server response was not available

Any help would be appreciated.

email
smtp
gmail
gmail-api
asked on Stack Overflow Dec 1, 2017 by XjSv • edited Dec 1, 2017 by XjSv

1 Answer

0

I had a same error. There is an option in Google account - https://myaccount.google.com/lesssecureapps. I turned it On and it helped me.

answered on Stack Overflow Dec 28, 2017 by Alex Lomanovich

User contributions licensed under CC BY-SA 3.0