ASP 可以使用JMAIL组件、CDONTS、ASPMAIL组件来发送邮件。个人只使用过jmail。
下载附件,安装完毕后即可使用(当然IIS是必备的啦~)。下面是我收集的相关文章,重复的很多。需要说明的一点就是,关于email优先级(1-5),网上说法不统一,但经过我实际操作,结论是,默认优先级(jmail.Priority=3),1的优先级最高!
=====================================================================================
asp使用jmail4.3的模块
常常要在网站中使用到JMAIL组件来发邮件。干脆就把常用的功能写成一个模块,方便调用。
把程序放到一个文件中,然后包含再call就可以了。(JMAIL4.3)
<%'警告函数
sub w_msg(message,w_to,w_link)
'message是你要弹出的警告信息,w_to=1表示自动后退一页,当w_to<>1时w_link表示要跳转的页面
if w_to="1" then
%>
<script language="javascript">
<!--
function Index(){ window.alert('<%=message%>');history.back(-1)}
Index();
-->
</script>
<%else%>
<script language="javascript">
<!--
function Index(){ window.alert('<%=message%>');window.location="<%=w_link%>"}
Index();
-->
</script>
<%end if
end sub%>
<%
sub sendmail(mailtitle,mailtext,mailaddress,mailcc,mailbcc,attachment,mailserver)
if mailtitle="" then
mailtitle="系统测试邮件"
end if
if mailtext="" then
mailtext="Just a test"
end if
if mailaddress="" then
call w_msg("邮件地址不能为空","1","")
end if
if mailserver="" then
mailserver="smtp.163.com"
end if
set msg=server.createobject("JMail.Message")
msg.silent = true
msg.logging = true
msg.Charset="GB2312"
msg.ContentType = "text/html"
msg.MailServerUserName="yourusername"
msg.MailServerPassword="yourpassword"
msg.From="youremail"
msg.FromName="dorryyang"
mailaddress_s=split(mailaddress,",") ' 邮件地址用,格开
for i=0 to ubound(mailaddress_s)
msg.AddRecipient trim(mailaddress_s(i))
next
if mailcc<>"" then
mailcc_s=split(mailcc,",")
for i=0 to ubound(mailcc_s)
msg.AddRecipientCC trim(mailcc_s(i))
next
end if
if mailbcc<>"" then
mailbcc_s=split(mailbcc,",")
for i=0 to ubound(mailbcc_s)
msg.AddRecipientBCC trim(mailbcc_s(i))
next
end if
if attachment<>"" then
msg.AddAttachment(attachment) 'attachment写附件地址
end if
msg.Subject=mailtitle
msg.HTMLBody=mailtext
msg.Send(mailserver)
msg.close
set msg=nothing
call w_msg("发送成功","1","")
end sub
%>
=====================================================================================
|
其余参考地址:(看过一遍,忘了再看)
http://zhidao.baidu.com/question/5374049.html http://www.it055.com/it055_infos/net_programs/asp/266_page1.htm
http://www.wzsky.net/html/article/asp/asp2/14040.html
http://hakaosans.yculblog.com/post.581113.html
http://www.rwrj.cn/Article/Class1/200402/20040220222235.html
http://study.zhupao.com/infoview/Article_16775.html
http://zhidao.baidu.com/question/5291335.html
http://www.home123.com.cn/FAQ/asp/1.html (这上面是关于jmail的一些常见问题。)
http://www.chinaphp.com/chinese/asp/1025538485.html (jmail)
http://www.mobanku.com/file/asp/00035.asp (cdonts)
http://www.zwwr.com/article/show.asp?id=20818 (关于发送附件)
附件下载:Jmail参考手册2本 w3jmail4_4组件
浙公网安备 33010602011771号