用jmail 发送邮件
yoken
阅读:1474
2007-10-15 01:39:00
评论:0
dim succeed
Set JMail1=server.createobject("JMail.Message")
JMail1.silent = true ''此项为true时,jmail返回出错代号,不会在网页上直接显示出错,发送不了,就会返回下面的jmail1.errorcode
jmail1.Charset = "gb2312"
jmail1.ContentTransferEncoding = "base64"
jmail1.Encoding = "base64"
jmail1.ISOEncodeHeaders = false
''JMail.MailServerUserName = "lparke" ''不需要
''JMail.MailServerPassword = "123456" ''不需要
JMail1.From = "123@eyou.com" ''发件人Email //这句话最好加上,这个可以是假的。
JMail1.AddRecipient "bluecup0001@yahoo.com.cn" ''收件人Email,多个收件人,就重复多行 -----改
JMail1.Subject = "信息" ''信件主题
JMail1.Body = "您好,这是我做的jmail测试。" ''信件内容要放到JMail.Send之前
''jmail1.htmlBody = "<font color=red>您好,这是我做的jmail测试。</font>" ''JMail1.Body是文本格式,这个是html格式,两个根据需要选一个。
succeed=JMail1.Send ("") ''""中为空,不需要设置,这样通用,发给很多信箱都可以。
if succeed=true then
response.write "恭喜您,邮件发送成功!^_^"
else
if int(jmail1.errorcode)=0 then
response.write "你所发送的E_mail地址不存在,或目前失去接受功能!"
else
response.write "服务器忙,请稍后再试!"
end if
end if
JMail1.Close()
set JMail1 = nothing
%>
''-----------------下面是第2种写法,由何常用于南方商旅--------------------------------
''发送邮件
webname="南方商旅"
''on error resume next
''发送注册邮件
topic="您的注册资料"
mailbody="<html>"
mailbody=mailbody & "<title>注册信息</title>"
mailbody=mailbody & "<body>"
mailbody=mailbody & "<TABLE border=0 width=''95%'' align=center><TBODY><TR>"
mailbody=mailbody & "<TD valign=middle align=top>"
mailbody=mailbody & "</TD></TR></TBODY></TABLE><br><hr width=95% size=1>"
mailbody=mailbody & "</body>"
mailbody=mailbody & "</html>"
mailsend = "kevor@126.com"
mailname = webname
mailusername = "kevor@126.com"
mailuserpass = "6132515"
mailaddress = "smtp.126.com"
Set JMail=Server.CreateObject("JMail.Message")
JMail.Charset="gb2312"
JMail.ContentType = "text/html"
JMail.from = mailsend
JMail.silent = true
JMail.Logging = true
JMail.FromName = mailname
JMail.mailserverusername = mailusername
JMail.mailserverpassword = mailuserpass
JMail.AddRecipient "kevor@126.com"
JMail.body=mailbody
JMail.Subject=topic
if not JMail.Send(mailaddress) then
SendMail=""
else
SendMail="OK"
end if
JMail.Close
if SendMail="OK" then
sendmsg="<p>· 您的注册信息已经发往您的邮箱,请注意查收!</p>"
else
sendmsg="<p>· 系统出错,注册信息资料未能发送到您的邮箱!</p>"
end if
response.write sendmsg
转载保留链接!网址:https://80920140.com/post/51.html
声明
1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源; 2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任; 3.作者投稿可能会经我们编辑修改或补充。
发表评论