使用 CDO.Message 在 Windows Server 2012 R2 上发送电子邮件时出现错误“80040211”
Error '80040211' Using CDO.Message to send emails on Windows Server 2012 R2
使用以下相同的 VBScript/ASP 文件,我只能设法在 Win7 PC 上发送电子邮件。当 运行 在 Windows Server 2012 R2 上使用相同的脚本,关闭所有防火墙时,我无法发送电子邮件。有一个 McAfee 病毒扫描程序,但即使我禁用它,我也无法发送电子邮件。我还在 Gmail 帐户上设置了 Allow less secure apps: ON
,但我仍然收到 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"
设置 telnet 后,我输入 telnet smtp.gmail.com 587,得到以下响应:
Gmail 被内部防火墙阻止。我已经切换到他们的内部 smtp 和端口。我已经设法发送了电子邮件。
使用此代码
<%
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
%>
使用以下相同的 VBScript/ASP 文件,我只能设法在 Win7 PC 上发送电子邮件。当 运行 在 Windows Server 2012 R2 上使用相同的脚本,关闭所有防火墙时,我无法发送电子邮件。有一个 McAfee 病毒扫描程序,但即使我禁用它,我也无法发送电子邮件。我还在 Gmail 帐户上设置了 Allow less secure apps: ON
,但我仍然收到 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"
设置 telnet 后,我输入 telnet smtp.gmail.com 587,得到以下响应:
Gmail 被内部防火墙阻止。我已经切换到他们的内部 smtp 和端口。我已经设法发送了电子邮件。
使用此代码
<%
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
%>