您的位置:首页 > Web前端 > HTML

如何使用cdonts组件发送html格式邮件

2008-03-17 17:10 701 查看

SUMMARY

loadTOCNode(1, '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

loadTOCNode(1, 'moreinformation');
Copy the following code into an Active Server Page on an Internet Information Server (IIS) computer that has CDONTS installed:

Sample code

loadTOCNode(2, 'moreinformation');
[code]    <%@ 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="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"
%>
</HEAD>
<BODY>
</BODY>
</HTML>

[/code]
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: