使用希伯来语文本从ASP中的表单发送的电子邮件编码问题

时间:2012-05-09 11:16:23

标签: jquery asp-classic cdo.message

我正在使用CDO.Message从ASP Classic网站上的联系表单向网站所有者发送电子邮件。该网站是希伯来语,我用UTF-8编码了所有内容。

我的问题是,在Outlook 2007中,从表单发送的希伯来文中出现了胡言乱语。电子邮件中的希伯来语中的其他文本(即硬编码文本)也能正确显示。

我已经在Outlook 2010中检查了这些电子邮件,并在Gmail上查看了这些电子邮件,所有希伯来语看起来都很好。

当然我的客户端有Outlook 2007,不太可能很快改变。

有谁知道如何解决这个问题?

以下是发送电子邮件的脚本:

Const CdoReferenceTypeName = 1
Dim objCDO, objBP
Set objCDO = Server.CreateObject("CDO.Message")
objCDO.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 
objCDO.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost"
objCDO.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 
objCDO.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False 
objCDO.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60

objCDO.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic (clear-text) authentication
objCDO.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = "aaaa@bbbbb.co.il"
objCDO.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "123456"
objCDO.Configuration.Fields.Update

objCDO.MimeFormatted = True
objCDO.To = email_to        
objCDO.Bcc = email_bcc
objCDO.From = email_from        

objCDO.Subject = email_subject      

objCDO.HTMLBody = email_body
objCDO.HTMLBodyPart.charset = "utf-8"
objCDO.BodyPart.charset = "utf-8"                                   

objCDO.Send

表单是通过jquery malsup表单插件提交的:

$('#contact_form').submit(function() {
    if (myvalidator.isValid()) {
        $(this).ajaxSubmit(function() { 
            $('#form_holder').html('thanks'); 
        });
    }
    return false;
});

表格也有一个附件,因此发送:

<form action="inc_contact_send.asp" method="post" enctype="multipart/form-data" id="contact_form">

1 个答案:

答案 0 :(得分:3)

尝试移动:

objCDO.BodyPart.charset = "utf-8" 

向上几行,以便在分配到HTMLBody之前。在调试时检查email_body的内容也是值得的,以确保它包含您期望的HTML。