ASP CDONTS.NEWMAIL组件发送Email邮件(附下载)
|
admin
2024年1月2日 10:47
本文热度 574
|
附CDONT.NEWMAIL组件下载地址:附件:cdonts.rar
ASP常规发送方法:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 | <%
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然后发送!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 | <%
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>"
%>
|
-完-
该文章在 2024/1/2 16:10:42 编辑过