Windows2000已经包含CDONTS.dll邮件组件。
Windows xp, Windows 2003 默认没有附带CDONTS.DLL,必须手动安装,你可以从Windows 2000的system32中得到该文件,
Step1: 将该文件拷贝至 %SystemRoot%\System32 下;
Step2: 开始 -> 运行 -> Regsvr32 cdonts.dll;
Step3: 确认
附:一个ASP调用CDONTS发邮件的示例:
<%
Dim oMail, sBody, sCc, sBCc, sTo, sFrom, sSubject, sContentBase
'//构造正文
sBody = "<HTML>" & _
"<HEAD>" & _
"<TITLE>用CDONTS发送邮件</TITLE>" & _
"<BODY>" & _
"WELCOME TO OUR COCOON sTudio.<BR>" & _
"<IMG SRC='http://www.ccopus.com/img/cocoon.gif'><p>" & _
"这幅图片来自AttachURL所指定的附件<IMG SRC=ha.jpg>" & _
"</BODY>" & _
"</HEAD>" & _
"</HTML>"
sSubject = "用CDONTS发送邮件"
sFrom = "[email protected]"
sTo = "[email protected]"
sCc = "[email protected]"
sBCc = "[email protected]"
sContentBase = "http://www.ccopus.com/"
Set oMail = Server.CreateObject("CDONTS.NewMail")
'//以URL形式添加附件,在附件列表中不可见,可以在正文中访问
oMail.AttachURL Server.MapPath("ha.jpg"), "ha.jpg"
'//以文件形式添加附件,在附件列表中可见,不可在正问中直接访问
oMail.AttachFile Server.MapPath("mail.asp"), "SMTPmail.txt"
'//指定mail正文的基地址,不能于AttachURL同时使用,否则,AttachURL附带的附件文件名将不正确。
'oMail.ContentBase = sContentBase
'//指定邮件主题
oMail.Subject = sSubject
'//指定发件人
oMail.From = sFrom
'//指定收件人,可写多个收件人,用逗号隔开
oMail.To = sTo
'//抄送给其他人,可以指定多个,用逗号隔开
oMail.Cc = sCc
'//暗抄给其他人,可以指定多个,用逗号隔开
oMail.BCc = sBCc
'//指定邮件正文
oMail.Body = sBody
'//指定邮件为HTML格式 '//0: The NewMail object is to be in MIME format. '//1: The NewMail object is to be in uninterrupted plain text (default value).
oMail.MailFormat = 0
'//指定邮件为MINE格式
'//0: The Body property is to include Hypertext Markup Language (HTML). '//1: The Body property is to be exclusively in plain text (default value).
oMail.BodyFormat = 0
'//指定邮件级别 0: 普通 1:机密 2:绝密
oMail.Importance=0
'//发送邮件
oMail.Send
Set oMail = Nothing