使用 ASP 和 CDOSYS 发送不同语言的邮件
我想发送一封使用阿拉伯语文本作为主题行的电子邮件。
该代码段将消息正文的特殊字符正确转换为阿拉伯文本,但未能将消息主题转换为阿拉伯文本。
我想知道我缺少什么?
Set objCDOSYS = Server.CreateObject("CDO.Message") Set objCDOConf = CreateObject("CDO.Configuration") Set objCDOFields = objCDOConf.Fields objCDOFields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 objCDOFields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "127.0.0.1" objCDOFields.Update Set objCDOSYS.Configuration = objCDOConf objCDOSYS.MimeFormatted=True objCDOSYS.BodyPart.Charset = "Windows-1256" objCDOSYS.From = Trim(Request.Form("frmSender")) objCDOSYS.To = Trim(Request.Form("frmRecipient")) objCDOSYS.Subject =Request.Form("frmSubject") objCDOSYS.HTMLBody = Trim(Request.Form("frmMessage")) objCDOSYS.HTMLBodyPart.charset = "Windows-1256" objCDOSYS.Fields.update objCDOSYS.Send Set objCDOFields = Nothing Set objCDOConf = Nothing Set objCDOSYS = Nothing
I want to send an email using arabic text as subject line.
The code piece converts the special characters into arabic text properly for message body but fails to do so for message subject.
I would like to know what I am missing ?
Set objCDOSYS = Server.CreateObject("CDO.Message") Set objCDOConf = CreateObject("CDO.Configuration") Set objCDOFields = objCDOConf.Fields objCDOFields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 objCDOFields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "127.0.0.1" objCDOFields.Update Set objCDOSYS.Configuration = objCDOConf objCDOSYS.MimeFormatted=True objCDOSYS.BodyPart.Charset = "Windows-1256" objCDOSYS.From = Trim(Request.Form("frmSender")) objCDOSYS.To = Trim(Request.Form("frmRecipient")) objCDOSYS.Subject =Request.Form("frmSubject") objCDOSYS.HTMLBody = Trim(Request.Form("frmMessage")) objCDOSYS.HTMLBodyPart.charset = "Windows-1256" objCDOSYS.Fields.update objCDOSYS.Send Set objCDOFields = Nothing Set objCDOConf = Nothing Set objCDOSYS = Nothing
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
更改为 UTF-8 字符集值得一试:-
我认为这将导致 Jirapong 尝试的编码类型,但 CDOSYS 会为您做到这一点。不幸的是,我知道它不适用于电子邮件地址中的显示名称。
Changing to the UTF-8 charset is worth a stab:-
I think that will result in the kind of encoding Jirapong was trying but CDOSYS will do it for you. Unfortunately I know that it doesn't work for display names in the email addresses.
您可能需要使用“=?UTF-8?B?”位于主题和阿拉伯语 Base64 编码字符串前面。
Base64Encode 函数可以在 - http://nolovelust.com/post/ 找到classic-asp-base64-encoder-decoder.aspx
注意:我自己也尝试过。所以不是100%确定。
You may need to use '=?UTF-8?B?' in front of subject and the Arabic base64 encoded string.
The Base64Encode function can find at - http://nolovelust.com/post/classic-asp-base64-encoder-decoder.aspx
Note: I did try this myself yet. so not 100% sure.
对我来说,这 4 项的组合有效:
For me the combination of these 4 items worked: