利用CDONTS发送邮件的ASP函数
程序员文章站
2023-02-18 14:09:10
<%last updated by recon on 05/14/2001on error resume next利用cdonts在win2k上发送邮件发送普通邮件sendm...
<%
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
%>
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
%>
上一篇: 无组件图文混合上传示例
下一篇: 一个简单的网上书城的例子(三)