Search code examples
vbscriptasp-classicwindows-server-2012-r2cdo.message

Error '80040211' Using CDO.Message to send emails on Windows Server 2012 R2


Using the following same VBScript/ASP files, I can only manage to send out the email on a Win7 PC. When running the same script on a Windows Server 2012 R2, with all the firewalls turned off, I was unable to send out the email. There is a McAfee virus scanner but even when I disable it, I was also unable to send the email out. I have also set the Allow less secure apps: ON on the Gmail account and I still get the error on '80040211' Please help me as I run out of ideas to troubleshoot.

Dim ObjSendMail

Set ObjSendMail = CreateObject("CDO.Message")

ObjSendMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
ObjSendMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
ObjSendMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
ObjSendMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = "True"
ObjSendMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
ObjSendMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
ObjSendMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "****@gmail.com"
ObjSendMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "*****"
ObjSendMail.Configuration.Fields.Update

ObjSendMail.Subject = "Testing Send Email"
ObjSendMail.From = "****@gmail.com"
ObjSendMail.To = "[email protected]"
ObjSendMail.HTMLBody = "Send mail successful"
ObjSendMail.Send

Set ObjSendMail = Nothing

response.Write "Email Sent Successfully"

After setting up telnet, I typed telnet smtp.gmail.com 587 and I get the following response:

Pic


Solution

  • Gmail is blocked by the internal firewall. I have switched to their internal smtp and port. I have managed to send out emails.