[英]CDOSYS and Unicode in the from field
I've got the code below, and I'm trying to set the from field to allow Unicode. 我有下面的代码,并且我试图设置from字段以允许Unicode。 Currently in my email client I get "??".
当前在我的电子邮件客户端中,我得到“ ??”。
The subject line and any content shows the Unicode correctly. 主题行和任何内容均正确显示Unicode。 And looking at the MSDN, the property should be
"urn:schemas:httpmail:from"
. 并查看MSDN,该属性应为
"urn:schemas:httpmail:from"
。
Anyone solved this issue? 有人解决了这个问题吗?
Dim AC_EMAIL : AC_EMAIL = "test@test.com"
Dim AC_EMAIL_FROM : AC_EMAIL_FROM = "测试 <test@test.com>"
Dim strSubject : strSubject = """测试"" testing testing"
set oMessage = WScript.CreateObject("CDO.Message")
With oMessage
.BodyPart.charset = "utf-8" 'unicode-1-1-utf-8
.Fields("urn:schemas:httpmail:from") = AC_EMAIL_FROM
.Fields("urn:schemas:httpmail:to") = AC_EMAIL
.Fields("urn:schemas:httpmail:subject") = strSubject
.Fields.Update
.Send
End With
Set oMessage = Nothing
Found a work around. 找到了解决方法。 Not the prettiest, but it works.
不是最漂亮的,但它可以工作。 Basically I converted the string to Quoted-Printable.
基本上,我将字符串转换为Quoted-Printable。
.Fields("urn:schemas:httpmail:from") = "=?utf-8?Q?=E6=8F?= <test@test.com>"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.