Avoiding local maildrop when using CDOSYS
I experienced strange problems with some ASP scripts at a clients hosted web server. The script sends e-mails after completed execution and occasionally (quite often) some of the e-mails are not delivered or are delivered much later than expected. When running in a hosted environment it is also very hard to track as you have very limited access to the server itself. After digging in some Microsoft documentation I noticed that it is possible to direct the traffic to the SMTP server of your choice instead. CDOSYS will execute a little bit slower but now I have the opportunity to target the e-mail to the SMTP server of my choice.
Set oCdoMail = Server.CreateObject(“CDO.Message”)
Set oCdoConf = Server.CreateObject(“CDO.Configuration”)
sConfURL = “http://schemas.microsoft.com/cdo/configuration/”
with oCdoConf
.Fields.Item(sConfURL & “sendusing”) = 2
.Fields.Item(sConfURL & “smtpserver”) = “smtp.themailserverofyourchoice.com”
.Fields.Item(sConfURL & “smtpserverport”) = 25
.Fields.Item(sConfURL & “smtpauthenticate”) = 1
.Fields.Item(sConfURL & “sendusername”) = “accountname@themailserverofyourchoice.com“
.Fields.Item(sConfURL & “sendpassword”) = “verysecretpassword”
.Fields.Update
end with
oCdoMail.From = ”fromemail@someserver.com”
oCdoMail.To = ”toemail@someserver.com”
oCdoMail.Subject = ”Subjct of the message”
oCdoMail.HTMLBody = “Some message including some HTML coding”
oCdoMail.Configuration = oCdoConf
oCdoMail.Send
Set oCdoConf = Nothing
Set oCdoMail = Nothing
You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.