[英]CDO.Message encoding issue
We're currently changing our mail delivery system to use solely UTF-8
. 我们目前正在更改邮件传递系统,使其仅使用
UTF-8
。
There seems to be a problem with the sender name, when the email contains non ASCII chars (hebrew) the subject & body render ok, but the sender name, as it appears in my gmail account, becomes - ??????
发件人名称似乎有问题,当电子邮件包含非ASCII字符(希伯来语)时,主题和正文可以正常显示,但是发件人名称(显示在我的gmail帐户中)变为-
??????
. 。
There is a line of code: 有一行代码:
myMail.BodyPart.Charset = "UTF-8"
So I thought there should be some code of the like: 所以我认为应该有一些类似的代码:
myMail.SenderName.Charset = "UTF-8"
But I can't seem to find the right code to use, assuming this would do the trick. 但是我似乎找不到合适的代码来使用,假设这样做可以解决问题。
This works for me: http://www.powerasp.net/content/new/sending_email_cdosys.asp 这对我有用: http : //www.powerasp.net/content/new/sending_email_cdosys.asp
Dim ObjSendMail
Set ObjSendMail = CreateObject("CDO.Message")
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "myserver"
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
ObjSendMail.Configuration.Fields.Update
ObjSendMail.To = to_email
ObjSendMail.Subject = subject
ObjSendMail.From = from_email
'ObjSendMail.TextBody = mensaje 'tipo texto
ObjSendMail.HTMLBody = mensaje 'tipo html
ObjSendMail.TextBodyPart.Charset = "utf-8" 'support symbols á ñ ¡
ObjSendMail.Send
Set ObjSendMail = Nothing
This worked for me. 这对我有用。
Set iMsg = CreateObject("CDO.Message")
With iMsg
.BodyPart.Charset = "utf-8"
End With
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.