简体   繁体   中英

email via SMTP - Outlook and Powershell OK, but VBscript/CDO does not work

I'm trying to send email via a remote SMTP: port 25, no authentication. I have this script, that gives me the 80040213 error ("The transport failed to connect to the server"). However, when I try with the same parameters from Outlook or Powershell, it works. I googled my ... off but I cannot find a solution. Any suggestions are welcome. Thanks.

Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "CDO test"
objMessage.From = "person@firm.com"
objMessage.To = "person@firm.com"
objMessage.TextBody = "This is a test email."

objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 

objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "<SMTPserver>"

objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

objMessage.Configuration.Fields.Update

objMessage.Send

OK. Finally I found out. McAfee Enterprise blocks communication via port 25 for some applications as a protection against "mass emailing worms".

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