Microsoft KB Archive/189945

= How to send HTML-formatted mail over SMTP by using CDONTS =

Article ID: 189945

Article Last Modified on 9/8/2005

-

APPLIES TO


 * Microsoft Collaboration Data Objects 1.2 for NT Server

-



This article was previously published under Q189945



SUMMARY
This article contains sample code that sends HTML-formatted mail from an Active Server Page (ASP) using CDONTS (Collaboration Data Objects for Microsoft Windows NT Server). You can use this code to programmatically send rich text and graphics embedded in a message.



MORE INFORMATION
Copy the following code into an Active Server Page on an Internet Information Server (IIS) computer that has CDONTS installed:

Sample code
<%@ Language=VBScript %>    <%

Dim myMail Dim HTML Set myMail = CreateObject("CDONTS.NewMail")

HTML = "<!DOCTYPE HTML PUBLIC""-//IETF//DTD HTML//EN"">" HTML = HTML & " " HTML = HTML & " " HTML = HTML & "" HTML = HTML & "" HTML = HTML & " HTMLMail " HTML = HTML & " " HTML = HTML & "" HTML = HTML & "" HTML = HTML & "  " HTML = HTML & "Microsoft Exchange CDONTS Example " HTML = HTML & " " HTML = HTML & "CDO for NTS allows an easy way to send mail. " HTML = HTML & "This example shows how the content can be " HTML = HTML & "an HTML page " HTML = HTML & "which allows you to send rich text and" HTML = HTML & "inline graphics. " HTML = HTML & " " HTML = HTML & " "

myMail.From="someone@microsoft.com" myMail.To="someone@microsoft.com" myMail.Subject="Sample CDONTS HTML Message" myMail.BodyFormat=0 myMail.MailFormat=0 myMail.Body=HTML myMail.Send set mymail=nothing Response.Write "Message Sent" %>      

Additional query words: kbMsg kbCDONTS kbASP kbVBScript

Keywords: kbhowto kbmsg kbhtml KB189945

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.