简体   繁体   English

使用CDO.Message在Windows Server 2012 R2上发送电子邮件时出现错误'80040211'

[英]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. 使用以下相同的VBScript / ASP文件,我只能设法在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. 在Windows Server 2012 R2上运行相同的脚本时,所有防火墙都已关闭,我无法发送电子邮件。 There is a McAfee virus scanner but even when I disable it, I was also unable to send the email out. 有一个McAfee病毒扫描程序,但是即使禁用它,我也无法发送电子邮件。 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. 我还对Gmail帐户设置了“ Allow less secure apps: ON ,但error on '80040211'仍然error on '80040211'error on '80040211'error on '80040211'进行故障排除。

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: 设置telnet后,我输入telnet smtp.gmail.com 587并得到以下响应:

图片

Gmail is blocked by the internal firewall. Gmail被内部防火墙阻止。 I have switched to their internal smtp and port. 我已切换到其内部的SMTP和端口。 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 %> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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