<!--#include file="include/func.asp"--><br>
<%<br>
last updated by recon on 05/14/2001<br>
on error resume next<br>
<br>
利用cdonts组件在win2k上发送邮件<br>
<br>
发送普通邮件<br>
sendmail "admin@ny.com", "iamchn@263.net", "normal mail!", "please check the attatchment!", 2, 0, "c:\love.txt"<br>
<br>
发送html邮件<br>
dim m_fso, m_tf<br>
dim m_strhtml<br>
<br>
set m_fso = server.createobject("scripting.filesystemobject")<br>
set m_tf = m_fso.opentextfile("c:\mail.htm", 1)<br>
m_strhtml = m_tf.readall<br>
<br>
write m_strhtml<br>
set m_tf = nothing<br>
set m_fso = nothing<br>
<br>
sendmail "admin@ny.com", "iamchn@263.net", "html mail!", m_strhtml, 2, 1, null<br>
<br>
参数说明<br>
strfrom : 发件人email<br>
strto : 收件人email<br>
strsubject : 信件主题<br>
strbody : 信件正文<br>
lngimportance : 信件重要性<br>
: 0 - 低重要性<br>
: 0 - 中等重要性(默认)<br>
: 0 - 高重要性<br>
lngatype : 信件格式<br>
: 为1时将邮件正文作为html(此时可以发送html邮件)<br>
strattach : 附件的路径<br>
sub sendmail(strfrom, strto, strsubject, strbody, lngimportance, lngatype, strattach)<br>
dim objmail<br>
<br>
set objmail = server.createobject("cdonts.newmail")<br>
with objmail<br>
<br>
.from = strfrom<br>
.to = strto<br>
.subject = strsubject<br>
.body = strbody<br>
.importance = lngimportance<br>
<br>
if lngatype = 1 then<br>
.bodyformat = 0<br>
.mailformat = 0<br>
end if<br>
<br>
if isempty(strattach) = false and isnull(strattach) = false then<br>
.attachfile strattach<br>
end if<br>
<br>
.send<br>
end with<br>
set objmail = nothing<br>
end sub<br>
%>
文章整理:站长天空 网址:http://www.z6688.com/
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!




