如何使用cdonts組件發送html格式郵件

SUMMARY

<script type="text/javascript">loadTOCNode(1, 'summary');</script>
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

<script type="text/javascript">loadTOCNode(1, 'moreinformation');</script>
Copy the following code into an Active Server Page on an Internet Information Server (IIS) computer that has CDONTS installed: 

Sample code

<script type="text/javascript">loadTOCNode(2, 'moreinformation');</script>
    <%@ Language=VBScript %>
    <HTML>
    <HEAD>
    <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
    <%

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

    HTML = "<!DOCTYPE HTML PUBLIC""-//IETF//DTD HTML//EN"">"
    HTML = HTML & "<html>"
    HTML = HTML & "<head>"
    HTML = HTML & "<meta http-equiv=""Content-Type"""
    HTML = HTML & "content=""text/html; charset=iso-8859-1"">"
    HTML = HTML & "<meta name=""GENERATOR"""
    HTML = HTML & " content=""Microsoft Visual Studio 6.0"">"
    HTML = HTML & "<title>HTMLMail</title>"
    HTML = HTML & "</head>"
    HTML = HTML & "<body bgcolor=""FFFFFF"">"
    HTML = HTML & "<IMG SRC=""http://www.microsoft.com/library/"
    HTML = HTML & "images/gifs/homepage/microsoft.gif"" BORDER=0 "
    HTML = HTML & "WIDTH=167 HEIGHT=36 ALT=""Microsoft Corporation"">"
    HTML = HTML & "<p><font size =""3"" face=""Arial""><strong>"
    HTML = HTML & "Microsoft Exchange CDONTS Example</strong></p>"
    HTML = HTML & "<p><font size =""2"" face=""Tahoma"">"
    HTML = HTML & "CDO for NTS allows an easy way to send mail.<br>"
    HTML = HTML & "This example shows how the content can be "
    HTML = HTML & "an HTML page<br>"
    HTML = HTML & "which allows you to send rich text and"
    HTML = HTML & "inline graphics.</p>"
    HTML = HTML & "</body>"
    HTML = HTML & "</html>"

    myMail.From="[email protected]"
    myMail.To="[email protected]"
    myMail.Subject="Sample CDONTS HTML Message"
    myMail.BodyFormat=0
    myMail.MailFormat=0
    myMail.Body=HTML
    myMail.Send
    set mymail=nothing
    Response.Write "Message Sent"
    %>
    </HEAD>
    <BODY>
    </BODY>
    </HTML>
發佈了4 篇原創文章 · 獲贊 0 · 訪問量 4萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章