asp通过JMAIL实现通用发送函数
程序员文章站
2023-01-24 23:31:00
<% '****************************** '函数:sendmail(mailtoaddress,mailtoname,subject,ma...
<%
'******************************
'函数:sendmail(mailtoaddress,mailtoname,subject,mailbody,fromname,mailfrom,priority)
'参数:mailtoaddress,接收邮件地址;mailtoname,接收者姓名;ubject,主题;ailbody,邮件内容;fomname,主送姓名;ailfrom,主送邮件地址;riority,邮件等级
'作者:阿里西西
'日期:2007/7/13
'描述:jmail通用发送函数
'示例:<%=sendmail(mailtoaddress,mailtoname,subject,mailbody,fromname,mailfrom,priority)%>
'******************************
function sendmail(mailtoaddress,mailtoname,subject,mailbody,fromname,mailfrom,priority)
on error resume next
dim jmail
set jmail=server.createobject("jmail.message")
if err then
sendmail= "<br><li>没有安装jmail组件</li>"
err.clear
exit function
end if
jmail.charset="gb2312"
jmail.silent=true
jmail.contenttype = "text/html"
jmail.mailserverusername = mailserverusername
jmail.mailserverpassword = mailserverpassword
jmail.maildomain = maildomain
jmail.addrecipient mailtoaddress,mailtoname
jmail.subject=subject
jmail.hmtlbody=mailbody
jmail.body=mailbody
jmail.fromname=fromname
jmail.from = mailfrom
jmail.priority=priority
jmail.send(mailserver)
sendmail =jmail.errormessage
jmail.close
set jmail=nothing
end function%>
'******************************
'函数:sendmail(mailtoaddress,mailtoname,subject,mailbody,fromname,mailfrom,priority)
'参数:mailtoaddress,接收邮件地址;mailtoname,接收者姓名;ubject,主题;ailbody,邮件内容;fomname,主送姓名;ailfrom,主送邮件地址;riority,邮件等级
'作者:阿里西西
'日期:2007/7/13
'描述:jmail通用发送函数
'示例:<%=sendmail(mailtoaddress,mailtoname,subject,mailbody,fromname,mailfrom,priority)%>
'******************************
function sendmail(mailtoaddress,mailtoname,subject,mailbody,fromname,mailfrom,priority)
on error resume next
dim jmail
set jmail=server.createobject("jmail.message")
if err then
sendmail= "<br><li>没有安装jmail组件</li>"
err.clear
exit function
end if
jmail.charset="gb2312"
jmail.silent=true
jmail.contenttype = "text/html"
jmail.mailserverusername = mailserverusername
jmail.mailserverpassword = mailserverpassword
jmail.maildomain = maildomain
jmail.addrecipient mailtoaddress,mailtoname
jmail.subject=subject
jmail.hmtlbody=mailbody
jmail.body=mailbody
jmail.fromname=fromname
jmail.from = mailfrom
jmail.priority=priority
jmail.send(mailserver)
sendmail =jmail.errormessage
jmail.close
set jmail=nothing
end function%>
上一篇: 线程的几种创建方式
下一篇: php对数组内元素进行随机调换的方法