使用正文中的UTF8字符签署DKIM错误

时间:2014-06-07 12:13:55

标签: .net dkim

我正在尝试为我的电子邮件签名DKIM。

使用非unicode主体,它运作良好:

This is a multi-part message in MIME format.

------=_NextPart_000_0011_01CF8271.717F57C0
Content-Type: text/plain;
    charset="windows-1258"
Content-Transfer-Encoding: 7bit

This is a test email from UltraMailer.

------=_NextPart_000_0011_01CF8271.717F57C0
Content-Type: text/html;
    charset="utf-8"
Content-Transfer-Encoding: 7bit

This is a test email from UltraMailer.
------=_NextPart_000_0011_01CF8271.717F57C0--

但如果内容包含utf-8字符,我收到来自Gmail的消息表明我的bodyhash(bh)有错:dkim = neutral(正文哈希未验证)

This is a multi-part message in MIME format.

------=_NextPart_000_0020_01CF8275.DAAA6BA0
Content-Type: text/plain;
    charset="windows-1258"
Content-Transfer-Encoding: 7bit

tieng viet




------=_NextPart_000_0020_01CF8275.DAAA6BA0
Content-Type: text/html;
    charset="utf-8"
Content-Transfer-Encoding: 8bit

tiếng việt 
<P>&nbsp;</P>
------=_NextPart_000_0020_01CF8275.DAAA6BA0--

我的DKIM标题:

DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mydomain.info; s=default; t=1402142861; bh=KjwC9TmOTS+OUAQOHQ9T6mW1PbMSe3HZ5uaN2ZDGcEQ=; h=From:To:Subject; b=DgZIGVaYd+tZ1VE7z1X2V7znolfmUp+ejSmsNmwYxIPlckH+AwrXyaetwbVGnkY9ybiUEcKXEhY6HRMMRIFZIb2QwbAhGNppN+lcvOBLVaghrVQ6Emg7dP1+VkzaJ1+qqROIg6pO+U/oAnFx4HH8mDGNvDxDlePrq5hSXvRKQ/c=

有什么不对?

1 个答案:

答案 0 :(得分:0)

这可能与Content-Transfer-Encoding: 8bit有关: 如果您使用特殊字符,Thunderbird会自动将内容传输编码切换为8位。

这可能会导致不同的DKIM签名应用程序出现问题。

请参阅:https://github.com/Pro/dkim-exchange/issues/86http://sourceforge.net/p/dkimproxy/mailman/message/188564/

因此,解决方案是强制雷鸟不使用8位编码。这可以通过将mail.strictly_mime设置为true来实现。 (见:http://forums.mozillazine.org/viewtopic.php?f=28&t=1697835