一个用jmail发信的过程,及使用方法.
发信时,直接调用这个过程就行了。
<%
dim str,htmlbody
htmlbody="<html><body bgcolor=red topmargin=40><p align=center>i love 2yup!</p></html>"
str=jmailsend( "2yup","iloveyou",true,htmlbody,"2yup@2yup.com","suercool@sina.com","suercool","smtp.sina.com.cn","suercool","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
%>