【问题标题】:DKIM Fails (body hash) when signing at MTA using opendkim使用 opendkim 在 MTA 上签名时 DKIM 失败(正文哈希)
【发布时间】:2014-09-18 17:30:26
【问题描述】:

我们在使用 opendkim 作为 Postfix 过滤器使用 DKIM 签署外发邮件时遇到了麻烦。

此问题仅在从 phpList 发送 HTML 电子邮件时发生。所有其他文本邮件和来自其他服务的邮件都正确签名并验证。 phpList使用phpMailer作为引擎。

如果我们以“文本”的形式发送邮件,那么我们就没有问题。如果我们以“HTML”的形式发送邮件,那么正文哈希将失败。

这个问题在 v2 中存在,但是我们曾经强制 phpList 只作为 HTML 发送。

当以 HTML 和 TEXT 电子邮件(这是 v3 中的默认设置)发送邮件时会发生此错误。

我认为这与换行/返回有关。

有人能指出我们正确的方向吗?

提前感谢您的帮助。

Port25 验证服务 - 通过 DKIM 的消息(仅文本)

==========================================================
Summary of Results
==========================================================
SPF check:          pass
DomainKeys check:   neutral
DKIM check:         pass
Sender-ID check:    pass
SpamAssassin check: ham

==========================================================
Details:
==========================================================


----------------------------------------------------------
DomainKeys check details:
----------------------------------------------------------
Result:         neutral (message not signed)
ID(s) verified: header.From=updates@flyawaysimulation.com
DNS record(s):

----------------------------------------------------------
DKIM check details:
----------------------------------------------------------
Result:         pass (matches From: updates@flyawaysimulation.com)
ID(s) verified: header.d=flyawaysimulation.com
Canonicalized Headers:
    to:check-auth-ryan=rbftpnetworks.com@verifier.port25.com'0D''0A'
    subject:Test'20'123'0D''0A'
    date:Thu,'20'18'20'Sep'20'2014'20'21:50:35'20'+0100'0D''0A'
    from:Fly'20'Away'20'Simulation'20'<updates@flyawaysimulation.com>'0D''0A'
    reply-to:Fly'20'Away'20'Simulation'20'<updates@flyawaysimulation.com>'0D''0A'
    list-help:<https://flyawaysimulation.com/lists/?p=preferences&uid=1e629246241f8e9714134ee8076ad406>'0D''0A'
    list-unsubscribe:<https://flyawaysimulation.com/lists/?p=unsubscribe&uid=1e629246241f8e9714134ee8076ad406&jo=1>'0D''0A'
    list-subscribe:<https://flyawaysimulation.com/lists/?p=subscribe>'0D''0A'
    list-owner:<mailto:abuse@flyawaysimulation.com>'0D''0A'
    dkim-signature:v=1;'20'a=rsa-sha256;'20'c=relaxed/simple;'20'd=flyawaysimulation.com;'20's=mail;'20't=1411073436;'20'bh=hhSjWh2jttCh3y1SOIZzUVlxN+KYTuNZ+eh16bzchHc=;'20'h=To:Subject:Date:From:Reply-To:List-Help:List-Unsubscribe:'20'List-Subscribe:List-Owner;'20'b=

Canonicalized Body:
    '20'test'20'123'0D''0A'
    '0D''0A'
    '0D''0A'
    '0D''0A'
    '20''20''0D''0A'


DNS record(s):
    mail._domainkey.flyawaysimulation.com. 3600 IN TXT "v=DKIM1;p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDimrx9MV1sFyUCVPeH6SFMBy7Cb2AU6aB9i3GazP7QKWG5pWWkFEurFImNbwi4wKz6dtKQeEkcGzPdzyeD+hXaSG2sl86T4pnwIxUaBMlW+FWfaNx0XPphacPAYjtkJGVoZGmmIbK3tH8HLZqdCEy6YIKd0kNSXQqFEMQseHaR6wIDAQAB"

Public key used for verification: mail._domainkey.flyawaysimulation.com (1024 bits)

NOTE: DKIM checking has been performed based on the latest DKIM specs
(RFC 4871 or draft-ietf-dkim-base-10) and verification may fail for
older versions.  If you are using Port25's PowerMTA, you need to use
version 3.2r11 or later to get a compatible version of DKIM.



==========================================================
Original Email
==========================================================

Return-Path: <updates@flyawaysimulation.com>
Received: from web3.rbftpnetworks.net (195.224.144.101) by verifier.port25.com id h3d2q211u9cu for <check-auth-ryan=rbftpnetworks.com@verifier.port25.com>; Thu, 18 Sep 2014 16:50:41 -0400 (envelope-from <updates@flyawaysimulation.com>)
Authentication-Results: verifier.port25.com; spf=pass smtp.mailfrom=updates@flyawaysimulation.com
Authentication-Results: verifier.port25.com; domainkeys=neutral (message not signed) header.From=updates@flyawaysimulation.com
Authentication-Results: verifier.port25.com; dkim=pass (matches From: updates@flyawaysimulation.com) header.d=flyawaysimulation.com
Authentication-Results: verifier.port25.com; sender-id=pass header.From=updates@flyawaysimulation.com
Received: by web3.rbftpnetworks.net (Postfix, from userid 70)
    id 2FF6D3E2B4BC; Thu, 18 Sep 2014 21:50:35 +0100 (BST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
    d=flyawaysimulation.com; s=mail; t=1411073436;
    bh=hhSjWh2jttCh3y1SOIZzUVlxN+KYTuNZ+eh16bzchHc=;
    h=To:Subject:Date:From:Reply-To:List-Help:List-Unsubscribe:
     List-Subscribe:List-Owner;
    b=kz3pyKnsxvzKKc9I764d8xwTxMQkJNcdHSup9+BOoNujSXTOyyAM1tpc5QWIhGMa4
     NOwsePDv5qfladW3kAh7TuwWW9geH6gdV9PhHF5RCg6jyHHbUY8t4mpIcW7w4yNuIK
     BMMbXk4+puGpEKdyRgfGKXxYjI0bVKK1Ck2vdb5Q=
To: check-auth-ryan=rbftpnetworks.com@verifier.port25.com
Subject: Test 123
Received: from host81-138-131-190.in-addr.btopenworld.com [81.138.131.190] by flyawaysimulation.com with HTTP; Thu, 18 Sep 2014 21:50:35 +0100
Date: Thu, 18 Sep 2014 21:50:35 +0100
From: Fly Away Simulation <updates@flyawaysimulation.com>
Reply-To: Fly Away Simulation <updates@flyawaysimulation.com>
Message-ID: <535768d2df1f49b5df91d9b010abeba9@flyawaysimulation.com>
X-Priority: 3
X-Mailer: PHPMailer 5.2.5 (https://github.com/Synchro/PHPMailer/)
X-phpList-version: 3.0.7
X-MessageID: 8
X-ListMember: check-auth-ryan=rbftpnetworks.com@verifier.port25.com
Precedence: bulk
Bounces-To: updates@flyawaysimulation.com
List-Help: <https://flyawaysimulation.com/lists/?p=preferences&uid=1e629246241f8e9714134ee8076ad406>
List-Unsubscribe: <https://flyawaysimulation.com/lists/?p=unsubscribe&uid=1e629246241f8e9714134ee8076ad406&jo=1>
List-Subscribe: <https://flyawaysimulation.com/lists/?p=subscribe>
List-Owner: <mailto:abuse@flyawaysimulation.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset=UTF-8

 test 123

Port25 验证服务 - DKIM 失败的邮件(文本/HTML 电子邮件)

==========================================================
Summary of Results
==========================================================
SPF check:          pass
DomainKeys check:   neutral
DKIM check:         fail
Sender-ID check:    pass
SpamAssassin check: ham

==========================================================
Details:
==========================================================


----------------------------------------------------------
DKIM check details:
----------------------------------------------------------
Result:         fail (wrong body hash: expected nb2kCq5nNBE+IfyLiAIH9t/9x7Kk5PpCb+1GdO/wiJ8=)
ID(s) verified: 
Canonicalized Headers:
    to:check-auth-ryan=rbftpnetworks.com@verifier.port25.com'0D''0A'
    subject:Test'20'123'0D''0A'
    date:Thu,'20'18'20'Sep'20'2014'20'21:52:19'20'+0100'0D''0A'
    from:Fly'20'Away'20'Simulation'20'<updates@flyawaysimulation.com>'0D''0A'
    reply-to:Fly'20'Away'20'Simulation'20'<updates@flyawaysimulation.com>'0D''0A'
    list-help:<https://flyawaysimulation.com/lists/?p=preferences&uid=1e629246241f8e9714134ee8076ad406>'0D''0A'
    list-unsubscribe:<https://flyawaysimulation.com/lists/?p=unsubscribe&uid=1e629246241f8e9714134ee8076ad406&jo=1>'0D''0A'
    list-subscribe:<https://flyawaysimulation.com/lists/?p=subscribe>'0D''0A'
    list-owner:<mailto:abuse@flyawaysimulation.com>'0D''0A'
    dkim-signature:v=1;'20'a=rsa-sha256;'20'c=relaxed/simple;'20'd=flyawaysimulation.com;'20's=mail;'20't=1411073540;'20'bh=XMTdnEvx/N4aZB10KoQqWOQW+MUVFvU66kqiSqm0XKc=;'20'h=To:Subject:Date:From:Reply-To:List-Help:List-Unsubscribe:'20'List-Subscribe:List-Owner;'20'b=

Canonicalized Body:
    --b1_b4a02db1226bc348457a47d51e902619'0D''0A'
    Content-Type:'20'text/plain;'20'charset=UTF-8'0D''0A'
    Content-Transfer-Encoding:'20'quoted-printable'0D''0A'
    '0D''0A'
    '20'test'20'123'0D''0A'
    '0D''0A'
    '0D''0A'
    '0D''0A'
    '0D''0A'
    '0D''0A'
    '0D''0A'
    '0D''0A'
    '20'=20'0D''0A'
    '0D''0A'
    '0D''0A'
    '0D''0A'
    --b1_b4a02db1226bc348457a47d51e902619'0D''0A'
    Content-Type:'20'text/html;'20'charset=UTF-8'0D''0A'
    Content-Transfer-Encoding:'20'quoted-printable'0D''0A'
    '0D''0A'
    <html><head>=0A'20''20''20''20''20''20''20''20'<meta'20'content=3D"text/html;charset=3DUTF-8"'20'http-equ='0D''0A'
    '0D''0A'
    iv=3D"Content-Type">=0A'20''20''20''20''20''20''20''20'<title></title></head><body><p>&nbsp;test'20'12='0D''0A'
    '0D''0A'
    3</p>=0A<img'20'src=3D"https://flyawaysimulation.com/lists/ut.php?u=3D1e629246='0D''0A'
    '0D''0A'
    241f8e9714134ee8076ad406&amp;m=3D8"'20'width=3D"1"'20'height=3D"1"'20'border=3D"0"'20'/='0D''0A'
    '0D''0A'
    ></body></html>'0D''0A'
    '0D''0A'
    '0D''0A'
    --b1_b4a02db1226bc348457a47d51e902619--'0D''0A'


DNS record(s):

NOTE: DKIM checking has been performed based on the latest DKIM specs
(RFC 4871 or draft-ietf-dkim-base-10) and verification may fail for
older versions.  If you are using Port25's PowerMTA, you need to use
version 3.2r11 or later to get a compatible version of DKIM.


==========================================================
Original Email
==========================================================

Return-Path: <updates@flyawaysimulation.com>
Received: from web3.rbftpnetworks.net (195.224.144.101) by verifier.port25.com id h3d30c11u9cb for <check-auth-ryan=rbftpnetworks.com@verifier.port25.com>; Thu, 18 Sep 2014 16:52:22 -0400 (envelope-from <updates@flyawaysimulation.com>)
Authentication-Results: verifier.port25.com; spf=pass smtp.mailfrom=updates@flyawaysimulation.com
Authentication-Results: verifier.port25.com; domainkeys=neutral (message not signed) header.From=updates@flyawaysimulation.com
Authentication-Results: verifier.port25.com; dkim=fail (wrong body hash: expected nb2kCq5nNBE+IfyLiAIH9t/9x7Kk5PpCb+1GdO/wiJ8=) 
Authentication-Results: verifier.port25.com; sender-id=pass header.From=updates@flyawaysimulation.com
Received: by web3.rbftpnetworks.net (Postfix, from userid 70)
    id 014C83E2B53F; Thu, 18 Sep 2014 21:52:19 +0100 (BST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
    d=flyawaysimulation.com; s=mail; t=1411073540;
    bh=XMTdnEvx/N4aZB10KoQqWOQW+MUVFvU66kqiSqm0XKc=;
    h=To:Subject:Date:From:Reply-To:List-Help:List-Unsubscribe:
     List-Subscribe:List-Owner;
    b=OXitjsekFORKng9NPtJ7GSrKROUf+EGj/zetZ7ZoXWGeZerr2+IUNFgSZcNPjub5M
     VazJtwOMRZ5g7r6SrUWjPfkpDH6nt3qecOW2E000ftsWwv78wPtD4mc0OIN/IsY52h
     vk+mbHrQb4ToUHmxIGRIfB/NOdDiXG7Gp+aVrgRY=
To: check-auth-ryan=rbftpnetworks.com@verifier.port25.com
Subject: Test 123
Received: from host81-138-131-190.in-addr.btopenworld.com [81.138.131.190] by flyawaysimulation.com with HTTP; Thu, 18 Sep 2014 21:52:19 +0100
Date: Thu, 18 Sep 2014 21:52:19 +0100
From: Fly Away Simulation <updates@flyawaysimulation.com>
Reply-To: Fly Away Simulation <updates@flyawaysimulation.com>
Message-ID: <b4a02db1226bc348457a47d51e902619@flyawaysimulation.com>
X-Priority: 3
X-Mailer: PHPMailer 5.2.5 (https://github.com/Synchro/PHPMailer/)
X-phpList-version: 3.0.7
X-MessageID: 8
X-ListMember: check-auth-ryan=rbftpnetworks.com@verifier.port25.com
Precedence: bulk
Bounces-To: updates@flyawaysimulation.com
List-Help: <https://flyawaysimulation.com/lists/?p=preferences&uid=1e629246241f8e9714134ee8076ad406>
List-Unsubscribe: <https://flyawaysimulation.com/lists/?p=unsubscribe&uid=1e629246241f8e9714134ee8076ad406&jo=1>
List-Subscribe: <https://flyawaysimulation.com/lists/?p=subscribe>
List-Owner: <mailto:abuse@flyawaysimulation.com>
MIME-Version: 1.0
Content-Type: multipart/alternative;
    boundary="b1_b4a02db1226bc348457a47d51e902619"

--b1_b4a02db1226bc348457a47d51e902619
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

 test 123







 =20



--b1_b4a02db1226bc348457a47d51e902619
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<html><head>=0A        <meta content=3D"text/html;charset=3DUTF-8" http-equ=

iv=3D"Content-Type">=0A        <title></title></head><body><p>&nbsp;test 12=

3</p>=0A<img src=3D"https://flyawaysimulation.com/lists/ut.php?u=3D1e629246=

241f8e9714134ee8076ad406&amp;m=3D8" width=3D"1" height=3D"1" border=3D"0" /=

> </body></html>


--b1_b4a02db1226bc348457a47d51e902619--

phpMailer 5.2.5版(与phpList一起打包)

更新: 如果我们在 opendkim 配置中启用 "FixCRLF yes",我们可以在 Port25 的测试器上通过 DKIM 验证检查。但是,这仍然失败 Gmail DKIM 验证。

用“FixCRLF yes”测试传递消息的输出:

==========================================================
Summary of Results
==========================================================
SPF check:          pass
DomainKeys check:   neutral
DKIM check:         pass
Sender-ID check:    pass
SpamAssassin check: ham


----------------------------------------------------------
DomainKeys check details:
----------------------------------------------------------
Result:         neutral (message not signed)
ID(s) verified: header.From=updates@flyawaysimulation.com
DNS record(s):

----------------------------------------------------------
DKIM check details:
----------------------------------------------------------
Result:         pass (matches From: updates@flyawaysimulation.com)
ID(s) verified: header.d=flyawaysimulation.com
Canonicalized Headers:
    to:check-auth-ryan=rbftpnetworks.com@verifier.port25.com'0D''0A'
    subject:Test'20'123'0D''0A'
    date:Sun,'20'21'20'Sep'20'2014'20'15:57:46'20'+0100'0D''0A'
    from:Fly'20'Away'20'Simulation'20'<updates@flyawaysimulation.com>'0D''0A'
    reply-to:Fly'20'Away'20'Simulation'20'<updates@flyawaysimulation.com>'0D''0A'
    list-help:<https://flyawaysimulation.com/lists/?p=preferences&uid=1e629246241f8e9714134ee8076ad406>'0D''0A'
    list-unsubscribe:<https://flyawaysimulation.com/lists/?p=unsubscribe&uid=1e629246241f8e9714134ee8076ad406&jo=1>'0D''0A'
    list-subscribe:<https://flyawaysimulation.com/lists/?p=subscribe>'0D''0A'
    list-owner:<mailto:abuse@flyawaysimulation.com>'0D''0A'
    dkim-signature:v=1;'20'a=rsa-sha256;'20'c=relaxed/simple;'20'd=flyawaysimulation.com;'20's=mail;'20't=1411311466;'20'bh=PUR9ib4HOSSj9G3jmXSCyzc1LAtqQeyWPSAii67TLd8=;'20'h=To:Subject:Date:From:Reply-To:List-Help:List-Unsubscribe:'20'List-Subscribe:List-Owner;'20'b=

Canonicalized Body:
    --b1_4ecb49f93b720bc688fe3bcdcafed5b0'0D''0A'
    Content-Type:'20'text/plain;'20'charset=UTF-8'0D''0A'
    Content-Transfer-Encoding:'20'quoted-printable'0D''0A'
    '0D''0A'
    '20'test'20'123'0D''0A'
    '0D''0A'
    '0D''0A'
    '0D''0A'
    '0D''0A'
    '0D''0A'
    '0D''0A'
    '0D''0A'
    '20'=20'0D''0A'
    '0D''0A'
    '0D''0A'
    '0D''0A'
    --b1_4ecb49f93b720bc688fe3bcdcafed5b0'0D''0A'
    Content-Type:'20'text/html;'20'charset=UTF-8'0D''0A'
    Content-Transfer-Encoding:'20'quoted-printable'0D''0A'
    '0D''0A'
    <html><head>=0A'20''20''20''20''20''20''20''20'<meta'20'content=3D"text/html;charset=3DUTF-8"'20'http-equ='0D''0A'
    '0D''0A'
    iv=3D"Content-Type">=0A'20''20''20''20''20''20''20''20'<title></title></head><body><p>&nbsp;test'20'12='0D''0A'
    '0D''0A'
    3</p>=0A<img'20'src=3D"https://flyawaysimulation.com/lists/ut.php?u=3D1e629246='0D''0A'
    '0D''0A'
    241f8e9714134ee8076ad406&amp;m=3D8"'20'width=3D"1"'20'height=3D"1"'20'border=3D"0"'20'/='0D''0A'
    '0D''0A'
    ></body></html>'0D''0A'
    '0D''0A'
    '0D''0A'
    --b1_4ecb49f93b720bc688fe3bcdcafed5b0--'0D''0A'


DNS record(s):
    mail._domainkey.flyawaysimulation.com. 3600 IN TXT "v=DKIM1;p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDimrx9MV1sFyUCVPeH6SFMBy7Cb2AU6aB9i3GazP7QKWG5pWWkFEurFImNbwi4wKz6dtKQeEkcGzPdzyeD+hXaSG2sl86T4pnwIxUaBMlW+FWfaNx0XPphacPAYjtkJGVoZGmmIbK3tH8HLZqdCEy6YIKd0kNSXQqFEMQseHaR6wIDAQAB"

Public key used for verification: mail._domainkey.flyawaysimulation.com (1024 bits)

NOTE: DKIM checking has been performed based on the latest DKIM specs
(RFC 4871 or draft-ietf-dkim-base-10) and verification may fail for
older versions.  If you are using Port25's PowerMTA, you need to use
version 3.2r11 or later to get a compatible version of DKIM.




==========================================================
Original Email
==========================================================

Return-Path: <updates@flyawaysimulation.com>
Received: from web3.rbftpnetworks.net (195.224.144.101) by verifier.port25.com id h3rjmm11u9c1 for <check-auth-ryan=rbftpnetworks.com@verifier.port25.com>; Sun, 21 Sep 2014 10:57:47 -0400 (envelope-from <updates@flyawaysimulation.com>)
Authentication-Results: verifier.port25.com; spf=pass smtp.mailfrom=updates@flyawaysimulation.com
Authentication-Results: verifier.port25.com; domainkeys=neutral (message not signed) header.From=updates@flyawaysimulation.com
Authentication-Results: verifier.port25.com; dkim=pass (matches From: updates@flyawaysimulation.com) header.d=flyawaysimulation.com
Authentication-Results: verifier.port25.com; sender-id=pass header.From=updates@flyawaysimulation.com
Received: by web3.rbftpnetworks.net (Postfix, from userid 70)
    id CDAD13E6DCB8; Sun, 21 Sep 2014 15:57:46 +0100 (BST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
    d=flyawaysimulation.com; s=mail; t=1411311466;
    bh=PUR9ib4HOSSj9G3jmXSCyzc1LAtqQeyWPSAii67TLd8=;
    h=To:Subject:Date:From:Reply-To:List-Help:List-Unsubscribe:
     List-Subscribe:List-Owner;
    b=skviRyhjPtB8aaRzLKyzkjay3Qk+Z5AOGg4Ue/Dk62SgvP1aZnf3kL1lCSWiwO1rI
     VKYmMzzspbKLxMVrZ0yXO0s4wx5u9EFNw4eJMNh6fKCimiNwEoSGQRkJcjNb7wA9nG
     38/FjbPIkvRyx1+hxgL9QOP3iSGv9w3X0UAFUmmc=
To: check-auth-ryan=rbftpnetworks.com@verifier.port25.com
Subject: Test 123
Received: from host81-138-131-190.in-addr.btopenworld.com [81.138.131.190] by flyawaysimulation.com with HTTP; Sun, 21 Sep 2014 15:57:46 +0100
Date: Sun, 21 Sep 2014 15:57:46 +0100
From: Fly Away Simulation <updates@flyawaysimulation.com>
Reply-To: Fly Away Simulation <updates@flyawaysimulation.com>
Message-ID: <4ecb49f93b720bc688fe3bcdcafed5b0@flyawaysimulation.com>
X-Priority: 3
X-Mailer: PHPMailer 5.2.5 (https://github.com/Synchro/PHPMailer/)
X-phpList-version: 3.0.7
X-MessageID: 8
X-ListMember: check-auth-ryan=rbftpnetworks.com@verifier.port25.com
Precedence: bulk
Bounces-To: updates@flyawaysimulation.com
List-Help: <https://flyawaysimulation.com/lists/?p=preferences&uid=1e629246241f8e9714134ee8076ad406>
List-Unsubscribe: <https://flyawaysimulation.com/lists/?p=unsubscribe&uid=1e629246241f8e9714134ee8076ad406&jo=1>
List-Subscribe: <https://flyawaysimulation.com/lists/?p=subscribe>
List-Owner: <mailto:abuse@flyawaysimulation.com>
MIME-Version: 1.0
Content-Type: multipart/alternative;
    boundary="b1_4ecb49f93b720bc688fe3bcdcafed5b0"

--b1_4ecb49f93b720bc688fe3bcdcafed5b0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

 test 123







 =20



--b1_4ecb49f93b720bc688fe3bcdcafed5b0
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<html><head>=0A        <meta content=3D"text/html;charset=3DUTF-8" http-equ=

iv=3D"Content-Type">=0A        <title></title></head><body><p>&nbsp;test 12=

3</p>=0A<img src=3D"https://flyawaysimulation.com/lists/ut.php?u=3D1e629246=

241f8e9714134ee8076ad406&amp;m=3D8" width=3D"1" height=3D"1" border=3D"0" /=

> </body></html>


--b1_4ecb49f93b720bc688fe3bcdcafed5b0--

发送到 Gmail 的同一封邮件:

Delivered-To: ****
Received: by 10.170.191.196 with SMTP id i187csp139225yke;
        Sun, 21 Sep 2014 08:05:20 -0700 (PDT)
X-Received: by 10.194.134.100 with SMTP id pj4mr14856269wjb.72.1411311920538;
        Sun, 21 Sep 2014 08:05:20 -0700 (PDT)
Return-Path: <updates@flyawaysimulation.com>
Received: from web3.rbftpnetworks.net (web3.rbftpnetworks.net. [195.224.144.101])
        by mx.google.com with ESMTP id db4si8324616wib.100.2014.09.21.08.05.20
        for <****>;
        Sun, 21 Sep 2014 08:05:20 -0700 (PDT)
Received-SPF: pass (google.com: domain of updates@flyawaysimulation.com designates 195.224.144.101 as permitted sender) client-ip=195.224.144.101;
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of updates@flyawaysimulation.com designates 195.224.144.101 as permitted sender) smtp.mail=updates@flyawaysimulation.com;
       dkim=neutral (body hash did not verify) header.i=@
Received: by web3.rbftpnetworks.net (Postfix, from userid 70)
    id E11B93E6E003; Sun, 21 Sep 2014 16:05:18 +0100 (BST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
    d=flyawaysimulation.com; s=mail; t=1411311919;
    bh=d40fzjdg7KnEX5wH3Ea2b1ZzoQMu8dzZyP1dYsxaoVc=;
    h=To:Subject:Date:From:Reply-To:List-Help:List-Unsubscribe:
     List-Subscribe:List-Owner;
    b=ub2LA6uRxpsgByD3RRUHqAGhlUu5d1gBgNadBBeaJdDP6pvSL/IX2Lzy6SqG2kGIK
     dU7YnOmI3w0frerJZRldlSAZduKUQqaT0QZHfvUZVJnLihK8EIZ7GkzX+6VVE2Pojm
     J8aVCq8fPOEuCG6mu2QdIUmpqkWO+s8bBYBYR6ro=
To: *****
Subject: Test 123
Received: from host81-138-131-190.in-addr.btopenworld.com [81.138.131.190] by flyawaysimulation.com with HTTP; Sun, 21 Sep 2014 16:05:18 +0100
Date: Sun, 21 Sep 2014 16:05:18 +0100
From: Fly Away Simulation <updates@flyawaysimulation.com>
Reply-To: Fly Away Simulation <updates@flyawaysimulation.com>
Message-ID: <8938d7bccca9e15cd846714ca4a01d04@flyawaysimulation.com>
X-Priority: 3
X-Mailer: PHPMailer 5.2.5 (https://github.com/Synchro/PHPMailer/)
X-phpList-version: 3.0.7
X-MessageID: 8
X-ListMember: ****
Precedence: bulk
Bounces-To: updates@flyawaysimulation.com
List-Help: <https://flyawaysimulation.com/lists/?p=preferences&uid=58f4e3c38a321901b99d714dd5f54850>
List-Unsubscribe: <https://flyawaysimulation.com/lists/?p=unsubscribe&uid=58f4e3c38a321901b99d714dd5f54850&jo=1>
List-Subscribe: <https://flyawaysimulation.com/lists/?p=subscribe>
List-Owner: <mailto:abuse@flyawaysimulation.com>
MIME-Version: 1.0
Content-Type: multipart/alternative;
    boundary="b1_8938d7bccca9e15cd846714ca4a01d04"

--b1_8938d7bccca9e15cd846714ca4a01d04
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

 test 123



 =20


--b1_8938d7bccca9e15cd846714ca4a01d04
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<html><head>=0A        <meta content=3D"text/html;charset=3DUTF-8" http-equ=
iv=3D"Content-Type">=0A        <title></title></head><body><p>&nbsp;test 12=
3</p>=0A<img src=3D"https://flyawaysimulation.com/lists/ut.php?u=3D58f4e3c3=
8a321901b99d714dd5f54850&amp;m=3D8" width=3D"1" height=3D"1" border=3D"0" /=
></body></html>


--b1_8938d7bccca9e15cd846714ca4a01d04--

【问题讨论】:

  • 代码?错误信息?好消息头和坏消息头的示例?什么版本的PHPMailer?
  • 对不起,我错过了 - 示例电子邮件已包含在上面(通过/失败的内容)。也确认了phpMailer版本。
  • 你能找到解决这个问题的方法吗?在发送文本/纯文本以外的电子邮件时,我也面临 DKIM 失败/中性的问题。尝试了我在 stackoverflow 和 google 中可以找到的几乎所有内容。
  • 你在使用 PHPList 吗?解决方案是下载较新版本的 PHPMailer 并覆盖 PHPList 使用的版本。

标签: php phpmailer postfix-mta dkim phplist


【解决方案1】:

我在发送到 Gmail 时遇到了您所描述的 [PlainText DKIM=pass] 和 [HTMLBody DKIM=fail] 的确切问题。我正在使用C# MailMessage,默认情况下正文默认字符集是“us-ascii”,它适用于基于文本的电子邮件,但不适用于 HTML 电子邮件。 Email Subject 的默认字符集为 UTF-8,无需重新设置。

发送 HTML 邮件时,必须在发送前编码以下参数:

Mailmessage.BodyEncoding = Encoding.UTF8;

在进行这个小改动后,Gmail 会再次注册我的电子邮件,并且我会收到 DKIM=pass;当我查看原始来源时。这些也是相关的标题

MIME-Version: 1.0
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: base64
*followed by block of base64 body text*

也许您可以使用 PHP 来模仿行为,也可以从

更改您的行为
Content-Transfer-Encoding: quoted-printable
to
Content-Transfer-Encoding: base64

【讨论】:

    【解决方案2】:

    也许不是一个很好的答案,但我通过使用 Amavis 而不是 opendkim 解决了这个问题。确保禁用 opendkim,因为不允许双重签名。

    这是我使用的手册:http://gogs.info/books/debian-mail/chunked/antispam.dkim.html

    【讨论】:

      【解决方案3】:

      好像有两个问题:

      1. Port25 验证程序完成的正文规范化错误。正文末尾是
        &gt; &lt;/body&gt;&lt;/html&gt;。那里的空间被错误地删除了。否则规范化是正确的。

      2. DKIM 签名中的正文散列似乎不是 Port25 接收到的正文的正确散列(使用两个不同的 DKIM 验证器,我得到正文散列 gjpXaqduU+jpM3yh1hPT5jqMSJZjHzi4KqAGlCG0/M8=)。这可能是由签名后更改的消息或签名过程中的错误引起的。 在 opendkim 中启用 KeepTemporaryFiles 以查看由 opendkim 完成的主体规范化,并将其与来自 Port25 的主体规范化进行比较(记住错误删除的空格)。如果可能,还要锁定已发送消息的来源,并尝试查看发送和接收正文之间的差异。

      更新:对启用了 FixCRLF 的消息的评论:

      phpList 似乎生成的电子邮件包含与 CRLF 不同的行尾,而 CRLF 是电子邮件中唯一允许的行尾。通常这不是问题,但正如您所见,它可能会导致 DKIM 出现问题,因为不同的行尾会产生不同的哈希值。

      向 Port25 发送带有“FixCRLF yes”的消息:

      opendkim 的规范化算法似乎有一个错误。发送到 Port25 的消息中的行 &gt; &lt;/body&gt;&lt;/html&gt; 被错误地引导到 &gt;&lt;/body&gt;&lt;/html&gt;(删除了空格)。由于 Port25 中的验证器存在相同的错误(因为它可能也使用 opendkim),因此 Port25 错误地将签名显示为有效。

      这似乎不是将消息发送到 gmail 失败的原因,但如果将消息发送到使用不同验证器的接收器,那么将来可能会导致麻烦,然后使用 opendkim。最好向他们报告这个问题。同时,您可以在发送消息之前自行删除空格。

      向 gmail 发送带有“FixCRLF 是”的消息:

      通过 gmail 收到的电子邮件的换行符少于从 Port25 收到的电子邮件。因此,除非发送消息已经不同,否则消息已被更改。在 opendkim 中启用“KeepTemporaryFiles”选项以查看由 opendkim 签名的正文。

      【讨论】:

      • 在 opendkim 配置中将“FixCRLF”设置为“yes”,它通过了端口 25 的验证。但是,具有相同配置的相同消息无法通过 gmail 验证。这有什么启示吗?感谢您的帮助。
      • 能否将 Port25 的报告添加到您的初始帖子中?
      • 我已经用通过的 FixCRLF 测试消息更新了初始帖子。我还包括发送到 Gmail 的测试的消息源(失败)。它通过了 Port25 并在 Gmail 上失败了。感谢您的帮助。
      猜你喜欢
      • 2018-02-03
      • 2013-10-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-07-03
      • 1970-01-01
      • 2023-04-01
      • 1970-01-01
      相关资源
      最近更新 更多