JMAIL发信的实例,模块化随时调用
类别: ASP教程
一个用jmail发信的过程,及使用方法.
发信时,直接调用这个过程就行了。
<%
dim str,HtmlBody
HtmlBody="<html><body bgcolor=\'red\' topmargin=\'40\'><p align=\'center\'>I Love 2Yup!</p></html>"
str=JmailSend( "hello","ILoveYou",true,HtmlBody,"youname@domain.com",youname@sina.com,
"hello","smtp.sina.com.cn","hello","Password")
if str="Y" then
response.write("发送成功")
else
response.write("发送失败!请重试!")
end if
\'=================================================
\'函数名:JmailSend
\'作 用:用Jmail发送邮件
\'参 数:Subject 邮件标题
\' Body 邮件内容
\' Body 邮件内容
\' isHtml 是否发送Html格式邮件 (true 是)
\' HtmlBody Html格式邮件内容
\' MailTo 收件人Email
\' From 发件人Email
\' FromName 发件人姓名
\' Smtp smtp服务器
\' Username 邮箱用户名
\' Password 邮箱密码
\'返回值:JmailSend="N" 发送失败 JmailSend="Y" 发送成功
\'~~~~~~~~~~suercool~~~~~
\'=================================================
function JmailSend(Subject,Body,isHtml,HtmlBody,MailTo,From,FromName,Smtp,Username,Password)
dim JmailMsg
set JmailMsg=server.createobject("jmail.message")
JmailMsg.mailserverusername=Username
JmailMsg.mailserverpassword=Password
JmailMsg.addrecipient MailTo
JmailMsg.from=From
JmailMsg.fromname=FromName
JmailMsg.charset="gb2312"
JmailMsg.logging=true
JmailMsg.silent=true
JmailMsg.subject=Subject
JmailMsg.body=Body
if isHtml=true then JmailMsg.htmlbody=HtmlBody
if not JmailMsg.send(Smtp) then
JmailSend="N"
else
JmailSend="Y"
end if
JmailMsg.close
set JmailMsg=nothing
end function
%>
发信时,直接调用这个过程就行了。
<%
dim str,HtmlBody
HtmlBody="<html><body bgcolor=\'red\' topmargin=\'40\'><p align=\'center\'>I Love 2Yup!</p></html>"
str=JmailSend( "hello","ILoveYou",true,HtmlBody,"youname@domain.com",youname@sina.com,
"hello","smtp.sina.com.cn","hello","Password")
if str="Y" then
response.write("发送成功")
else
response.write("发送失败!请重试!")
end if
\'=================================================
\'函数名:JmailSend
\'作 用:用Jmail发送邮件
\'参 数:Subject 邮件标题
\' Body 邮件内容
\' Body 邮件内容
\' isHtml 是否发送Html格式邮件 (true 是)
\' HtmlBody Html格式邮件内容
\' MailTo 收件人Email
\' From 发件人Email
\' FromName 发件人姓名
\' Smtp smtp服务器
\' Username 邮箱用户名
\' Password 邮箱密码
\'返回值:JmailSend="N" 发送失败 JmailSend="Y" 发送成功
\'~~~~~~~~~~suercool~~~~~
\'=================================================
function JmailSend(Subject,Body,isHtml,HtmlBody,MailTo,From,FromName,Smtp,Username,Password)
dim JmailMsg
set JmailMsg=server.createobject("jmail.message")
JmailMsg.mailserverusername=Username
JmailMsg.mailserverpassword=Password
JmailMsg.addrecipient MailTo
JmailMsg.from=From
JmailMsg.fromname=FromName
JmailMsg.charset="gb2312"
JmailMsg.logging=true
JmailMsg.silent=true
JmailMsg.subject=Subject
JmailMsg.body=Body
if isHtml=true then JmailMsg.htmlbody=HtmlBody
if not JmailMsg.send(Smtp) then
JmailSend="N"
else
JmailSend="Y"
end if
JmailMsg.close
set JmailMsg=nothing
end function
%>
- 上一篇: 实现有管理功能的ASP留言板
- 下一篇: 纯ASP(VBSCRIPT)写的全球IP地址搜索程序
-= 资 源 教 程 =-
文 章 搜 索