1、解决页面乱码使用:
<
% Response.Charset
=
"
utf-8
"
%
>
2、解决发送邮件body乱码问题:
oJmail.Charset
=
"
GB2312
"
oJmail.ISOEncodeHeaders = false
oJmail.ISOEncodeHeaders = false
3、具体事例:
<
%@Language
=
"
VBScript
"
CodePage
=
"
65001
"
%
>
< % Response.Charset = " utf-8 " % >
< %
Set ojmail = Server.CreateObject( " jmail.Message " ) ' 建立物件
oJmail.silent = true ' 屏蔽例外错误,返回FALSE跟TRUE两值j
oJmail.logging = true ' 启用邮件日志
oJmail.Charset = " GB2312 " ' 解决中文乱码问题
oJmail.ISOEncodeHeaders = false ' 解决中文乱码问题
oJmail.ContentType = " text/html " ' 郵件正文格式
oJmail.From = " lover_116@163.com " ' 設定寄件人的E-MAIL地址
oJmail.AddRecipient " hong@iwishwed.com " ' 設定收件人的地址
ojmail.MailServerUserName = " lover_116@163.com " ' 登录邮件器所需的用户名
ojmail.MailServerPassword = " 13836536417 " ' 登录邮件器所需的密码
oJmail.FromName = Request.Form( " useName " ) ' 收件人名称
oJmail.Subject = " 咨询项目 " ' 设定信件主旨
' oJmail.setContent(html,"text/html;charset=gb2312")
ojmail.Body = " <p><b>姓名:</b> " + Request.Form( " useName " ) + " </p> "
' oJmail.appendText = "你好呀哈哈哈" '追加内容
if not oJmail.Send( " smtp.163.com " ) then ' 送出郵件(通過寄件服務器地址)
Response.Write oJmail.Log
Else
Response.Write " 您所填写的内容已经成功发送出去,我们会通过邮件的方式与您联系,谢谢您的来访 "
End If
oJmail.Close () ' 关闭对象
Set oJmail = nothing
% >
< % Response.Charset = " utf-8 " % >
< %
Set ojmail = Server.CreateObject( " jmail.Message " ) ' 建立物件
oJmail.silent = true ' 屏蔽例外错误,返回FALSE跟TRUE两值j
oJmail.logging = true ' 启用邮件日志
oJmail.Charset = " GB2312 " ' 解决中文乱码问题
oJmail.ISOEncodeHeaders = false ' 解决中文乱码问题
oJmail.ContentType = " text/html " ' 郵件正文格式
oJmail.From = " lover_116@163.com " ' 設定寄件人的E-MAIL地址
oJmail.AddRecipient " hong@iwishwed.com " ' 設定收件人的地址
ojmail.MailServerUserName = " lover_116@163.com " ' 登录邮件器所需的用户名
ojmail.MailServerPassword = " 13836536417 " ' 登录邮件器所需的密码
oJmail.FromName = Request.Form( " useName " ) ' 收件人名称
oJmail.Subject = " 咨询项目 " ' 设定信件主旨
' oJmail.setContent(html,"text/html;charset=gb2312")
ojmail.Body = " <p><b>姓名:</b> " + Request.Form( " useName " ) + " </p> "
' oJmail.appendText = "你好呀哈哈哈" '追加内容
if not oJmail.Send( " smtp.163.com " ) then ' 送出郵件(通過寄件服務器地址)
Response.Write oJmail.Log
Else
Response.Write " 您所填写的内容已经成功发送出去,我们会通过邮件的方式与您联系,谢谢您的来访 "
End If
oJmail.Close () ' 关闭对象
Set oJmail = nothing
% >