我正在尝试为我的PHP电子邮件设置DKIM,但是当我向isnotspam.com发送电子邮件时,它说:
X_DKIM_Status: fail (signature_incorrect)
我使用没有密码的ssh-keygen生成了一个公共/私有rsa密钥对。我已将私钥放在我的服务器上,并将公钥放入我的DNS记录中:
TXT default._domainkey v=DKIM1;t=s;p=XXXXXXXXX
我使用PHPMailer在GoDaddy共享服务器上发送代码。 PHP版本已过时,因此我必须使用PHPMailer的5.2版本:
// Start of PHP code
$mail = new PHPMailer();
$mail->isSMTP();
$mail->Host = "localhost";
$mail->SMTPAuth = true;
$mail->Username = $username;
$mail->Password = $password;
$mail->SMTPSecure = "ssl";
$mail->Port = 465;
$mail->setFrom($email, $name);
$mail->addAddress($email_address, "");
// Setup DKIM
$mail->DKIM_domain = "letmein.org";
$mail->DKIM_private = $key_path;
$mail->DKIM_selector = "default";
$mail->DKIM_passphrase = "";
$mail->DKIM_identity = $mail->From;
// Send the email
$mail->isHTML(true);
$mail->Body = $html;
$mail->AltBody = "Plain text";
$mail->Subject = $subject;
$mail->send();
电子邮件发送正常,但未通过DKIM检查。我尝试使用专门用于DKIM密钥的网站生成的新密钥替换现有密钥(还检查了DNS记录中的新公钥是否已被选中)。
原始电子邮件:
From mark@letmein.org Sun Dec 24 16:05:48 2017
Return-path: <mark@letmein.org>
X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on
localhost.localdomain
X-Spam-Flag: YES
X-Spam-Level: ****
X-Spam-Report:
* -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no
* trust
* [188.121.43.193 listed in list.dnswl.org]
* 3.5 BAYES_99 BODY: Bayes spam probability is 99 to 100%
* [score: 1.0000]
* -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3)
* [188.121.43.193 listed in wl.mailspike.net]
* -0.0 SPF_PASS SPF: sender matches SPF record
* 0.2 BAYES_999 BODY: Bayes spam probability is 99.9 to 100%
* [score: 1.0000]
* 0.1 HTML_MESSAGE BODY: HTML included in message
* 0.8 MPART_ALT_DIFF BODY: HTML and text parts are different
* -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's
* domain
* 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily
* valid
* -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature
* -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders
X-Spam-Status: Yes, hits=4.5 required=-20.0 tests=BAYES_99,BAYES_999,
DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HTML_MESSAGE,MPART_ALT_DIFF,
RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_PASS autolearn=no
autolearn_force=no version=3.4.0
Envelope-to: ins-xqvykojr@isnotspam.com
Delivery-date: Sun, 24 Dec 2017 16:05:48 +0000
Received: from n1nlsmtp03.shr.prod.ams1.secureserver.net ([188.121.43.193])
by localhost.localdomain with esmtp (Exim 4.84_2)
(envelope-from <mark@letmein.org>)
id 1eT8mZ-000CeP-TQ
for ins-xqvykojr@isnotspam.com; Sun, 24 Dec 2017 16:05:48 +0000
Received: from n1plcpnl0106.prod.ams1.secureserver.net ([188.121.57.40])
by : HOSTING RELAY : with SMTP
id T8lWeadPYo71OT8lWeAKc1; Sun, 24 Dec 2017 09:04:42 -0700
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=letmein.org
; s=default; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID
:Subject:From:To:Date:Sender:Reply-To:Cc:Content-ID:Content-Description:
Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:
In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:
List-Post:List-Owner:List-Archive;
bh=okJ3Yvq2jDr8JtULj6ItIiWaJF2OOV2IKKV7bcEXKD8=; b=FwSTkJ4lmwddF4ql5xz6ZlDxAm
DFRNxX7DjFrJXgcrJAwmk+GFR6vuj9yIeU0Sv7sZx3CTPdTVPNcmXYUrEEbeOEULCg6Gtvq5Iiocy
TPhVuPoz9vKlp59oIY20iIGBGb4Exa46GZJl7myIme8p8zAqs2JvDoBYxjCihbBxY79Ccebr+7kKS
Rhtx8eNsiZgXfNRAkVYeRHwGS0RgFVSt+7OdBJgTKGrmFRYgAwNMsngl/kicSgdpR6l1aZCKiTLqz
8gVeXXZ3CaHgupEc11m3m4y2B1igYiLGB1OBsbYI0oxgoOMDpWz2cGUFqJWOYzih4nlwMchZsPydT
qfXbWL+Q==;
Received: from [127.0.0.1] (port=40914 helo=www.letmein.org)
by n1plcpnl0106.prod.ams1.secureserver.net with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256)
(Exim 4.89)
(envelope-from <mark@letmein.org>)
id 1eT8lW-001NfM-PR
for ins-xqvykojr@isnotspam.com; Sun, 24 Dec 2017 09:04:42 -0700
Date: Sun, 24 Dec 2017 16:04:37 +0000
To: ins-xqvykojr@isnotspam.com
From: Mark McCorrie <mark@letmein.org>
Subject: Test Email
Message-ID: <5335fe27777b3c14ed79690ca2bb1584@www.letmein.org>
X-Mailer: PHPMailer 5.2.26 (https://github.com/PHPMailer/PHPMailer)
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="b1_5335fe27777b3c14ed79690ca2bb1584"
Content-Transfer-Encoding: 8bit
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; l=394; s=default;
t=1514131477; c=relaxed/simple;
h=From:To:Date:Subject;
d=letmein.org; i=mark@letmein.org;
z=From:=20Mark=20McCorrie=20<mark@letmein.org>
|To:=20ins-xqvykojr@isnotspam.com
|Date:=20Sun,=2024=20Dec=202017=2016:04:37=20+0000
|Subject:=20Test=20Email;
bh=okJ3Yvq2jDr8JtULj6ItIiWaJF2OOV2IKKV7bcEXKD8=;
b=DdTZwAhwG5veqdzYalqHZemZxrI8jP3nN60bYQ3QLB1SizMeXJPY3CDASb0jD0p7jvPJ7S0EWVRGUd4OYf4G9JOtuPJ5gyXcIaLskHaR1C2UkK7VEsdULpTuBOyi7NNNykKj0Bb/Phf4E9a5KS1fTQ/zeRHcUuaTlCqUqmKxsfQ=
X-AntiAbuse: This header was added to track abuse, please include it with any abuse report
X-AntiAbuse: Primary Hostname - n1plcpnl0106.prod.ams1.secureserver.net
X-AntiAbuse: Original Domain - isnotspam.com
X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse: Sender Address Domain - letmein.org
X-Get-Message-Sender-Via: n1plcpnl0106.prod.ams1.secureserver.net: authenticated_id: mark@letmein.org
X-Authenticated-Sender: n1plcpnl0106.prod.ams1.secureserver.net: mark@letmein.org
X-Source:
X-Source-Args:
X-Source-Dir:
X-CMAE-Envelope: MS4wfPwC1Xxnn9g6j5zbro5YKM7KLqmVfWh0KVY65g/CeDYX+99xryWgrTFmrIqXyjax2lhli+BPTzUFMcNEi0jmyvPoh7bb5eN1483k57SPVgGzVF736hje
JeW4+Womlh7Mp70ZEMTbXH9nJ5WO+R98qk7fuq1gLqB6PO1Y4OZ4NW8e52fTMhNAsNPTqEjdZs56FumTu5tMlbJRhCDFtwc51/s=
X-DKIM-Status: fail (signature_incorrect)
X-DKIM-Status: pass (mark@letmein.org)
This is a multi-part message in MIME format.
--b1_5335fe27777b3c14ed79690ca2bb1584
Content-Type: text/plain; charset=us-ascii
Plain text
--b1_5335fe27777b3c14ed79690ca2bb1584
Content-Type: text/html; charset=us-ascii
<html><body>
<p>Hi Mark,</p>
<p>This is a test email to see if you are using DKIM correctly.</p></body></html>
--b1_5335fe27777b3c14ed79690ca2bb1584--
有什么想法吗?
P.S。我一直在摆弄钥匙,目前的DNS记录可能与上面的原始电子邮件不符。