Information
Article ID84
Created On10/18/2008
Modified10/18/2008
CDOSYS Sample Script

CDOSYS may be used to send mail programmatically from your classic ASP pages. CDOSYS is the replacement for CDONTS which was deprecated after NT4. CDOSYS is available on all of our web servers. Below is a simple example written in ASP.

green text = comments
red text = fields that you will need to customize

-----

<%
Dim objCDOSYSCon
Set objCDOSYSMail = Server.CreateObject("CDO.Message")
Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration")
'Out going SMTP server
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "www.yourdomain.com"
'SMTP port
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
'Timeout
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
objCDOSYSCon.Fields.Update
Set objCDOSYSMail.Configuration = objCDOSYSCon
'Who the e-mail is from
objCDOSYSMail.From = "you@yourdomain.com"
'Who the e-mail is sent to
objCDOSYSMail.To = "recipient@theirdomain.com"
'The subject of the e-mail
objCDOSYSMail.Subject = "Subject goes here"
'Set the e-mail body format (HTMLBody=HTML TextBody=Plain)
objCDOSYSMail.HTMLBody = "email message goes here"
objCDOSYSMail.Send
Set objCDOSYSMail = Nothing
Set objCDOSYSCon = Nothing
%>