各大高校宿舍:JMail发送问题
if Request.form("flag")=1 then
'SMTPServer="smtp.163.com"
'SMTPServer_username="name"
'SMTPServer_passwd="******"
SMTPServer=trim(Application("SMTPServer"))
SMTPServer_username=Application("SMTPServer_username")
SMTPServer_passwd=Application("SMTPServer_passwd")
SystemEmail=trim(Application("SystemEmail"))
SenderName=trim(Application("SenderName"))
email=trim(Request.form("towho"))
topic=trim(Request.form("topic"))
mailbody=trim(Request.form("mailbody"))
on error resume next
dim msg,SendMail
Set msg = Server.CreateObject("JMail.Message")
msg.silent = true
msg.Logging = true
msg.Charset = "gb2312"
msg.contentType="text/html"
msg.MailServerUserName = SMTPServer_username
msg.MailServerPassword = SMTPServer_passwd
' 设置优先级,范围从1到5,越大的优先级越高,3为普通
msg.Priority = 3
msg.From = SystemEmail
msg.FromName = SenderName
msg.AddRecipient email
msg.Subject = topic
msg.Body = "<font color=red>"&mailbody&"</font>"
msg.Send (SMTPServer)
set msg=nothing
if err then
SendMail=err.description
err.clear
else
SendMail="ok"
end if
%>
我用这代码发送出去邮件,为什么邮件主题和收件人后面会显示一些乱码?
例如:
发件人: "千千结网络管理员C7=A7=C7=A7=BD=E1=CD=F8=C2=E7=B9=DC=C0=ED=D4=B1?=" <521qqj@163.com>
主 题: 千千结白领交友中心C7=A7=C7=A7=BD=E1=B0=D7=C1=EC=BD=BB=D3=D1=D6=D0=D0=C4?=
我可以给你一个好点的,我用了是很好用的。。
<%
Set msg = Server.CreateObject("JMail.Message")
msg.silent = true
msg.Logging = true
msg.Charset = "gb2312"
msg.MailServerUserName = "info@asfas.com" '输入smtp服务器验证登陆名 (邮局中任何一个用户的Email地址)
msg.MailServerPassword = "www" '输入smtp服务器验证密码 (用户Email帐号对应的密码)
msg.From = "info@asfas.com" '发件人Email
msg.FromName = "上海信息网" '发件人姓名
msg.AddRecipient request("email") '收件人Email
msg.Subject = ""&request("username")&":你在上海信息网的注册资料" '信件主题
msg.Body = ""& vbcrlf &" 用户名:"&request("username")&" "& vbcrlf &" 注册密码:"&request("password")&" "& vbcrlf &" 取回密码问题:"&request("passworda")&" "& vbcrlf &" 取回密码答案:"&request("passworda")&" "& vbcrlf &""& vbcrlf &"-------------------------------------------"& vbcrlf &"欢迎大家光临上海信息网(http://www.asfas.com) " '正文
msg.Send ("211.147.225.135") 'smtp服务器地址(企业邮局地址)
set msg = nothing
%>