Tutorial
CDOSYS is a built-in component in ASP. This build is used to send e-mail through ASP.
Use CDOSYS to send e-mail
CDO (Collaboration Data Objects) is a Microsoft technology designed to simplify the creation of communication programs.
Cdocdosys is a built-in component in ASP. We will show you how to use this component to send e-mail.
How about CDONTS?
Microsoft has eliminated CDONTS in Windows 2000, Windows XP, and Windows 2003. If you also use CDONTS in your application, you need to update the code and use the new CDO technology.
Using an instance of CDOSYS
Send e-mail:
<%set mymail=createobject ("CDO.") Message "] mymail.subject=" sending email with CDO "mymail.from=" mymail@mydomain.com "mymail.to=" Someone@somedomain.com "mymail.textbody=" is a message. Mymail.sendset mymail=nothing%>
Use the BCC and CC fields to send text messages:
<%set mymail=createobject ("CDO.") Message "] mymail.subject=" sending email with CDO "mymail.from=" mymail@mydomain.com "mymail.to=" Someone@somedomain.com "mymail.bcc=" someoneelse@somedomain.com "mymail.cc=" someoneelse2@somedomain.com " Mymail.textbody= "This is a message." Mymail.sendset mymail=nothing%>
To send an HTML message:
<%set mymail=createobject ("CDO.") Message "] mymail.subject=" sending email with CDO "mymail.from=" mymail@mydomain.com "mymail.to=" someone@somedomain.com "Mymail.htmlbody ="
Send an HTML message that is routed through a Web site:
<%set mymail=createobject ("CDO.") Message "] mymail.subject=" sending email with CDO "mymail.from=" mymail@mydomain.com "mymail.to=" Someone@somedomain.com "Mymail.createmhtmlbody" http://www.webjx.com/"Mymail.sendset mymail=nothing%>
Send an HTML message from a file on your computer to send a Web page:
<%set mymail=createobject ("CDO.") Message "] mymail.subject=" sending email with CDO "mymail.from=" mymail@mydomain.com "mymail.to=" Someone@somedomain.com "Mymail.createmhtmlbody" file://c:/mydocuments/test.htm "Mymail.sendset mymail=nothing%>
Send a message with an attachment:
<%set mymail=createobject ("CDO.") Message "] mymail.subject=" sending email with CDO "mymail.from=" mymail@mydomain.com "mymail.to=" Someone@somedomain.com "mymail.textbody=" is a message. Mymail.addattachment "C:\mydocuments\test.txt" Mymail.sendset mymail=nothing%>
To send a text message using a remote server:
<%set mymail=createobject ("CDO.") Message "] mymail.subject=" sending email with CDO "mymail.from=" mymail@mydomain.com "mymail.to=" Someone@somedomain.com "mymail.textbody=" is a message. MyMail.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/sendusing") =2 ' Name or IP of Remote SMTP ServermyMail.Configuration.Fields.Item _ ("Http://schemas.microsoft.com/cdo/configuration/smtpserver") _= "smtp.server.com" ' Server PortmyMail.Configuration.Fields.Item _ (' http://schemas.microsoft.com/cdo/ Configuration/smtpserverport ") _=25 myMail.Configuration.Fields.UpdatemyMail.Sendset mymail=nothing%>