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
投稿

猜你喜欢

  • pygame游戏之旅 创建游戏窗口界面

    2022-05-19 18:42:00
  • Python伪随机数模块random详解

    2022-12-21 01:06:39
  • Python中easy_install 和 pip 的安装及使用

    2023-08-24 13:34:54
  • 玩转-SQL2005数据库行列转换

    2024-01-23 23:28:02
  • Python Django框架单元测试之文件上传测试示例

    2022-02-26 23:50:51
  • 在 SQL Server 数据库开发中的十大问题

    2009-07-02 16:39:00
  • MySQL中索引优化distinct语句及distinct的多字段操作

    2024-01-18 20:43:38
  • 使用Python脚本和ADB命令实现卸载App

    2023-04-11 03:59:39
  • Python实现点阵字体读取与转换的方法

    2022-11-08 08:33:27
  • 解密ThinkPHP3.1.2版本之模板继承

    2023-09-06 16:02:15
  • 详解如何利用Python实现报表自动化

    2021-08-25 19:28:45
  • 在IE下用getAttribute时要小心

    2008-08-21 12:54:00
  • 在python3中实现查找数组中最接近与某值的元素操作

    2023-10-30 22:35:19
  • python实现决策树分类算法

    2022-08-10 12:15:56
  • Go语言单链表实现方法

    2024-02-14 15:46:45
  • Tensorflow之MNIST CNN实现并保存、加载模型

    2023-10-16 06:21:33
  • 利用python实现命令行有道词典的方法示例

    2021-03-24 06:32:16
  • Python 4种实现定时任务的方案

    2021-12-12 18:08:27
  • vue3动态路由刷新后空白或者404问题的解决

    2023-07-02 16:58:39
  • 宝塔面板成功部署Django项目流程(图文)

    2022-07-29 13:11:19
  • asp之家 网络编程 m.aspxhome.com