asp使用jmail4.3的模块

来源:CSDN 时间:2010-03-17 20:58:00 

把程序放到一个文件中,然后包含再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
%>

标签:jmail,模块,asp
0
投稿

猜你喜欢

  • 从IIS到SQL Server数据库安全

    2008-12-24 15:58:00
  • 很有意思的SQL多行数据拼接

    2011-11-03 17:08:29
  • 如何获得上一个月份是几月?

    2009-11-23 20:38:00
  • 怎样在SQL Server中去除表中不可见字符

    2009-02-05 15:23:00
  • Oracle数据库与SQL Server数据库镜像对比

    2009-04-11 16:24:00
  • 将SQL 2000日志迁移到SQL Server 2008

    2009-03-25 16:20:00
  • 在Oracle中向视图中插入数据的方法

    2009-02-28 10:42:00
  • 想用户所想(感受亚马逊的设计)

    2007-08-26 17:09:00
  • 符合标准的纯CSS三 级弹出菜单

    2008-01-06 15:34:00
  • 新手入门:防范SQL注入攻击的新办法

    2009-03-11 15:14:00
  • 如何用css制作有趣的按钮

    2008-03-17 13:54:00
  • 轻松掌握 MySQL的数字类型以及建库策略

    2008-11-27 16:09:00
  • [JS效果]动画效果打开/关闭/移动层

    2008-04-10 11:42:00
  • 网站LOGO设计规范的思考--2.网络LOGO的设计

    2007-10-14 11:02:00
  • 谈切图优化加速图片显示—淘宝实例

    2008-01-30 12:24:00
  • WEB界面设计五种特征

    2010-03-16 12:34:00
  • 页面制作的重要性

    2007-10-30 13:14:00
  • 蜕变——记QQ医生3.0

    2009-09-16 14:41:00
  • ASP获取远程文件大小信息(通过header头信息)

    2010-03-11 21:25:00
  • OverFlow – 一个秘密武器

    2010-09-25 12:51:00
  • asp之家 网络编程 m.aspxhome.com