email - 如何修正发送电子邮件泰语文本?

  显示原文与译文双语对照的内容

我尝试通过. asp ( 经典) 页面发送泰国语 E-mail 。 代码在下面


<%
response.write(GetLocale() &"<br/>")
SetLocale(1054)
response.write(GetLocale())


Set Mail = CreateObject("CDO.Message")

Mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
Mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="smtp.gmail.com"
Mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465

Mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 1

Mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60

Mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
Mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") ="xxx@gmail.com"
Mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") ="xxx"

Mail.Configuration.Fields.Update

Mail.Subject="ระบบแจ้งเตือนอัตโนมัติ"
Mail.From="xxx@gmail.com"
Mail.To="xxx@hotmail.com"
Mail.TextBody="สวัสดี"



Mail.Send
Set Mail = Nothing

%>

但我得到的结果是 E-mail

任何 body 都知道如何修复,请帮助?

固定的方法是( 按以下 ulluoink )

将这个已知的bit-o-goodness添加到你的页面中:


Response.CodePage = 65001
Response.CharSet ="utf-8"

更改 xml:


<?xml version="1.0" encoding="UTF-8"?>.

你也可以确保你的元标记不存在:


<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>

并使用这里代码 Pattern:


<%
function TestEMail(sFrom, sTo, sSubject, sBody, sBcc)
 Set objMail = Server.CreateObject("CDO.Message")
 Set objConf = Server.CreateObject("CDO.Configuration") 
 Set objFields = objConf.Fields
 With objFields
. Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
. Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="mail.secureserver.net"
. Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10 
. Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
. Update 
 End With

 With objMail
 Set. Configuration = objConf
. BodyPart.Charset ="utf-8"
. From = sFrom
. To = sTo
. Subject = sSubject
. TextBody = sBody
 if sBcc <>"" then. Bcc = sBcc
 End With

 objMail.Send
 Set objFields = Nothing
 Set objConf = Nothing
 Set objMail = Nothing
End function
%>

时间: 作者:

你必须使用 UTF-8 编码进行以下操作:

  • asp页面( 该文件必须保存在 UTF-8 编码中)
  • 然后使用以下方法在asp中设置编码:

    Response.CodePage = 65001

    Response.CharSet = UTF-8"

  • 在消息对象的正文正文中设置 UTF-8:

    Mail.BodyPart.Charset = UTF-8"

在这里查看 ,这里是( cdo和 UTF-8 例子)

作者:
...