ASP tutorials: Learn to master using CDOSYS to send e-mail messages

Source: Internet
Author: User
Tags mail
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%>


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.