简体   繁体   中英

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 = "hello123@gmail.com"
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:

图片

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

Use this code

 <% Set myMail=CreateObject("CDO.Message") myMail.BodyPart.Charset = "UTF-8" myMail.Subject= Your Message Subject myMail.From= "anotheremail@anotherdomain.com" myMail.To=Receiver Email Address myMail.CreateMHTMLBody "Test Email Subject" myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing")=2 myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver")= SMTP_SERVER myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25 myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername")=SMTP_Email_Username myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword")=Smtp_Email_Password myMail.Configuration.Fields.Update myMail.Send set myMail=nothing %> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM