当前位置: 移动技术网 > IT编程>开发语言>.net > 利用CDONTS发送邮件的ASP函数

利用CDONTS发送邮件的ASP函数

2019年01月13日  | 移动技术网IT编程  | 我要评论

戒酒吧,上海云山医院,裘慕远

<%
last updated by recon on 05/14/2001
on error resume next

利用cdonts在win2k上发送邮件

发送普通邮件
sendmail "admin@ny.com", "iamchn@263.net", "normal mail!", "please check the attatchment!", 2, 0, "c:love.txt"

发送html邮件
dim m_fso, m_tf
dim m_strhtml

set m_fso = server.createobject("scripting.filesystemobject")
set m_tf = m_fso.opentextfile("c:mail.htm", 1)
m_strhtml = m_tf.readall

write m_strhtml
set m_tf = nothing
set m_fso = nothing

sendmail "admin@ny.com", "iamchn@263.net", "html mail!", m_strhtml, 2, 1, null

参数说明
strfrom : 发件人email
strto : 收件人email
strsubject : 信件主题
strbody : 信件正文
lngimportance : 信件重要性
: 0 - 低重要性
: 0 - 中等重要性(默认)
: 0 - 高重要性
lngatype : 信件格式
: 为1时将邮件正文作为html(此时可以发送html邮件)
strattach : 附件的路径
sub sendmail(strfrom, strto, strsubject, strbody, lngimportance, lngatype, strattach)
dim objmail

set objmail = server.createobject("cdonts.newmail")
with objmail

.from = strfrom
.to = strto
.subject = strsubject
.body = strbody
.importance = lngimportance

if lngatype = 1 then
.bodyformat = 0
.mailformat = 0
end if

if isempty(strattach) = false and isnull(strattach) = false then
.attachfile strattach
end if

.send
end with
set objmail = nothing
end sub
%>


如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网