·您的位置: 首页 » 资源教程 » 编程开发 » ASP » 使用CDONTS发送邮件的几个例子

使用CDONTS发送邮件的几个例子

类别: ASP教程  评论数:0 总得分:0
<!--#include file="include/common.asp"-->
<!--#include file="include/func.asp"-->
<%
\'Last Updated By Recon On 05/14/2001
\'On Error Resume Next

\'利用CDONTS组件在Win2k上发送邮件
Dim objMail

\'普通邮件
\'无主体
Set objMail = Server.CreateObject("CDONTS.NEWMAIL")
objMail.From = "iamchn@263.net"
objMail.To = "iamchn@21cn.com"
objMail.Subject = "TEST1"
objMail.Send
Set objMail = Nothing

\'普通邮件
\'有主体
Set objMail = Server.CreateObject("CDONTS.NEWMAIL")
objMail.From = "iamchn@263.net"
objMail.To = "iamchn@21cn.com"
objMail.Subject = "TEST2"
objMail.Body = "When i was young, i listened to the radio ..."
objMail.Send
Set objMail = Nothing

\'普通邮件
\'有多送.有主体
Set objMail = Server.CreateObject("CDONTS.NEWMAIL")
objMail.From = "iamchn@263.net"
objMail.To = "iamchn@21cn.com;iamchn@263.net"
objMail.Subject = "TEST3"
objMail.Body = "When i was young, i listened to the radio ..."
objMail.Send
Set objMail = Nothing

\'普通邮件
\'有抄送.有主体.有重要性
Set objMail = Server.CreateObject("CDONTS.NEWMAIL")
objMail.From = "iamchn@263.net"
objMail.To = "iamchn@21cn.com"
objMail.Cc = "iamchn@263.net;recon_chan@sohu.com"
objMail.Subject = "TEST4"
objMail.Body = "When i was young, i listened to the radio ..."
objMail.Importance = 2
objMail.Send
Set objMail = Nothing

\'普通邮件
\'有抄送.有暗送.有主体.有重要性
Set objMail = Server.CreateObject("CDONTS.NEWMAIL")
objMail.From = "iamchn@263.net"
objMail.To = "iamchn@21cn.com"
objMail.Cc = "recon_chan@sohu.com"
objMail.Bcc = "iamchn@263.net;recon_chan@sina.com"
objMail.Subject = "TEST5"
objMail.Body = "When i was young, i listened to the radio ..."
objMail.Importance = 2
objMail.Send
Set objMail = Nothing

\'普通邮件
\'有主体.有重要性.含附件
Set objMail = Server.CreateObject("CDONTS.NEWMAIL")
objMail.From = "iamchn@263.net"
objMail.To = "iamchn@21cn.com"
objMail.Subject = "TEST6"
objMail.Body = "When i was young, i listened to the radio ..."
objMail.Importance = 2

objMail.AttachFile "C:Love.txt"
objMail.Send
Set objMail = Nothing

\'HTML邮件
\'有主体.有重要性
\'注: AttachURL的使用可能有错误
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:common.css", "common.css"
objMail.AttachURL "c:logo.gif", "logo.gif"
objMail.Send
Set objMail = Nothing
%>
-= 资 源 教 程 =-
文 章 搜 索
关键词:
类型:
范围:

纯粹空间 softpure.com
Copyright © 2006-2012 暖阳制作 版权所有
承接程序设计 网页设计
QQ: 15242663 (隐身在线 拒绝闲聊)  Email: faisun@sina.com

 纯粹空间 - 韩国酷站|酷站欣赏|教程大全|资源下载|免费博客|美女壁纸|设计素材|技术论坛  

百度搜索 谷歌搜索 Alexa搜索 | 粤ICP备19116064号-1