附CDONT.NEWMAIL组件下载地址:http://files.cnblogs.com/files/colinliu/cdonts.rar
ASP常规发送方法:
<%
dim mail
set mail=server.createobject("cdonts.newmail")
mail.From=fromwho "发件人信箱
mail.To = towho "收件人信箱
mail.Subject =subject "主题
mail.Body =body "邮件正文
mail.MailFormat=0 "说明是以MIME发送
mail.BodyFormat=0 "可以包含html代码
mail.Importance=0 "邮件的优先级别0-1-2
mail.cc=xx@xx.net "抄送
mail.Bcc=xx@sf.net "密送
mail.AttachFile attachfile "附件
mail.Send
Set mail=Nothing
response.Write "<script language='javascript'>alert('电邮已发送');</script>"
%>
读取HTML然后发送!
<%
Dim fso, tf
Dim strHTML Set fso = Server.CreateObject("SCRIPTING.FILESYSTEMOBJECT")
Set tf = fso.OpenTextFile("C:\Mail.htm", 1)
strHTML = tf.ReadAll Write strHTML
Set tf = Nothing
Set fso = Nothing Set objMail = Server.CreateObject("CDONTS.NEWMAIL")
objMail.From = "iamchn@263.net"
objMail.To = "iamchn@21cn.com"
objMail.Subject = "TEST7"
objMail.Body = strHTML objMail.BodyFormat = 0
objMail.MailFormat = 0
objMail.Importance = 2
objMail.AttachURL "c:\logo.gif", "logo.gif"
objMail.Send
Set objMail = Nothing
response.Write "<script language='javascript'>alert('电邮已发送');</script>"
%>
-完-