Active Server Pages Tutorial

Sending E-mail using Collaboration Data Objects (CDO)

Collaboration Data Objects is an object library of the Messaging Application Programming Interface (MAPI). It is built into ASP and can be used, for example, to send e-mail:

<% Set HolidayMail=CreateObject(“CDO.Message”) HolidayMail.Subject=”Happy Valentine’s Day!” HolidayMail.From=”webmaster@holidaytips.com” HolidayMail.To=”johndoe@aol.com” HolidayMail.TextBody=”Visit us for 50 tips on a romantic Valentine’s Day.” HolidayMail.Send %>

The TextBody property formats the body of the e-mail as text; you can use HTMLBody to format the body as HTML:

HolidayMail.HTMLBody=”

50 Tips for Valentine’s Day

CreateHTMLBody sends an HTML file:

HolidayMail.CreateHTMLBody=”http://www.holidaytips.com/news/Feb.htm”

Or:

HolidayMail.CreateHTMLBody=”file://c:/LearnASP/email.htm”

Leave a Reply

Your email address will not be published. Required fields are marked *