在隐藏密钥的phpmailer代码中使用dkim

时间:2014-07-15 07:27:27

标签: phpmailer dkim

我正在使用PHPMailer。

我在发送文件时添加了DKIM属性。

代码如下:

// $mail is PHPMailer class
$mail->SMTPAuth = true; 
$mail->SMTPSecure = "ssl";
$mail->Host = "*******"; 
$mail->Port  = ***; 
$mail->Mailer= "SMTP";
//...
$mail->DKIM_domain = 'mydomain.com';
$mail->DKIM_identity = '@mydomain.com';

$mail->DKIM_private =  __DIR__ . '/privacy_key_mydomain.txt';
$mail->DKIM_selector = 'default';
$mail->DKIM_passphrase = ''; // only ssl.
//...

(与Send mail in phpmailer using DKIM Keys上的示例相同)

发送电子邮件时,例如我的(gmail),我没有问题,我看到我的电子邮件是由mydomain.com签名的。

我也看到,在电子邮件来源中发送了DKIM-Signature。

然而,我发送电子邮件的一些客户拒绝我的电子邮件,并留下以下消息(特别是对于雅虎电子邮件 - 更多的是90%的拒绝使用雅虎的电子邮件)。

554不允许消息 - 标题不符合RFC [291]

当我做了一些解决方法时,我发现此邮件被检测为垃圾邮件。

我正在为我的网站使用CPANEL,它有圆形立方体 - 所以我在圆形立方体上测试它(向客户发送带有圆形立方体的消息) - 似乎没问题。没有垃圾邮件检测。

所以,我怀疑隐私密钥文件可能不正确(我有一个SSL网站 - 所以我使用与我自己的网站相同的隐私密钥。)

可能有什么问题?我应该检查什么以避免我的电子邮件被检测为垃圾邮件?

以下是电子邮件来源结果:

Delivered-To: myaccount@gmail.com
Received: by 10.114.75.12 with SMTP id y12csp118366ldv;
        Tue, 15 Jul 2014 11:44:11 -0700 (PDT)
X-Received: by 10.140.104.49 with SMTP id z46mr36090427qge.74.1405449850437;
        Tue, 15 Jul 2014 11:44:10 -0700 (PDT)
Return-Path: <support@mydomain.com>
Received: from lin9.maindomain10.net (lin9.maindomain10.net. [1.2.3.4])
        by mx.google.com with ESMTPS id t14si21957304qac.66.2014.07.15.11.44.09
        for <myaccount@gmail.com>
        (version=TLSv1 cipher=RC4-SHA bits=128/128);
        Tue, 15 Jul 2014 11:44:10 -0700 (PDT)
Received-SPF: pass (google.com: domain of support@mydomain.com designates 1.2.3.4 as permitted sender) client-ip=1.2.3.4;
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of support@mydomain.com designates 1.2.3.4 as permitted sender) smtp.mail=support@mydomain.com;
       dkim=pass header.i=@mydomain.com
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mydomain.com; s=default;
    h=Content-Type:Content-Transfer-Encoding:MIME-Version:Message-ID:Subject:Reply-To:From:To:Date:Subject:To; bh=HBLjhR1eb0w5FQ9aVj60Gu0x3jP9XWQ7LQkpzTRHjfQ=;
    b=ECWMCs3iPsjuvlT473K9u3skwyNRVunmnv3p440Nk2ZJVrbuWoO0vgzaWM8gjCC503ADKivdfrrOek8TgTSEI7G4B3WMCHI50PWq68W5rcscYJqErWxuqAVcSl4r5tomk88AYPhHiotCugmRTjwQ2K/JBtHsAvMhTlVQMMXsMl0=;
Received: from mainuser by lin9.maindomain10.net with local (Exim 4.82)
    (envelope-from <support@mydomain.com>)
    id 1X77hp-0001f9-SH; Tue, 15 Jul 2014 14:44:01 -0400
To: myName Mizrahi <myaccount@gmail.com>
Subject: Statistics from Sample Name site
Date: Tue, 15 Jul 2014 14:44:01 -0400
To: myName Mizrahi <myaccount@gmail.com>
From: "donotreply@mydomain.com" <root@localhost>
Reply-To: Sample Name site <donotreply@mydomain.com>
Subject: Statistics from Sample Name site
Message-ID: <d984a2c6308ef2a97cf6ccfe6292263a@mydomain.com>
X-Priority: 3
X-Mailer: PHPMailer 5.2.4 (http://code.google.com/a/apache-extras.org/p/phpmailer/)
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/html; charset=UTF-8
X-AntiAbuse: This header was added to track abuse, please include it with any abuse report
X-AntiAbuse: Primary Hostname - lin9.maindomain10.net
X-AntiAbuse: Original Domain - gmail.com
X-AntiAbuse: Originator/Caller UID/GID - [927 895] / [47 12]
X-AntiAbuse: Sender Address Domain - mydomain.com
X-Get-Message-Sender-Via: lin9.maindomain10.net: authenticated_id: mainuser/sender_address_domain 

从圆形多维数据集发送邮件时,电子邮件来源如下所示:

Delivered-To: myaccount@gmail.com
Received: by 10.114.75.12 with SMTP id y12csp118605ldv;
        Tue, 15 Jul 2014 11:48:53 -0700 (PDT)
X-Received: by 10.224.161.129 with SMTP id r1mr34110372qax.86.1405450132678;
        Tue, 15 Jul 2014 11:48:52 -0700 (PDT)
Return-Path: <support@mydomain.com>
Received: from lin9.maindomain10.net (lin9.maindomain10.net. [1.2.3.4])
        by mx.google.com with ESMTPS id x8si13226659qas.81.2014.07.15.11.48.52
        for <myaccount@gmail.com>
        (version=TLSv1 cipher=RC4-SHA bits=128/128);
        Tue, 15 Jul 2014 11:48:52 -0700 (PDT)
Received-SPF: pass (google.com: domain of support@mydomain.com designates 1.2.3.4 as permitted sender) client-ip=1.2.3.4;
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of support@mydomain.com designates 1.2.3.4 as permitted sender) smtp.mail=support@mydomain.com;
       dkim=pass header.i=@mydomain.com
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mydomain.com; s=default;
    h=Message-ID:Subject:To:From:Date:Content-Transfer-Encoding:Content-Type:MIME-Version; bh=Bynm51C7RZD/vZ81iEMKjxxLoAJtSmKFcwU/eyFzPs8=;
    b=fUX+UKS9Ua0HK35AOBRBJbmqTEuKscCYAsPyxs3If3dhhvb/AvAjl1gR9Rz9AN0EX0mu275wtaN5Y1JWP+8w8VcGebJ9FEWsltCl9nwqL6bos/eEqJxTWjDG6ch9MHo3G0mSE326Pyc13JWa59InSgJyWi8MSstT1POfuEhfe28=;
Received: from localhost.localdomain ([127.0.0.1]:54911 helo=mydomain.com)
    by lin9.maindomain10.net with esmtpa (Exim 4.82)
    (envelope-from <support@mydomain.com>)
    id 1X77mO-0001l7-1O
    for myaccount@gmail.com; Tue, 15 Jul 2014 14:48:44 -0400
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8;
 format=flowed
Content-Transfer-Encoding: 7bit
Date: Tue, 15 Jul 2014 14:48:43 -0400
From: support@mydomain.com
To: myaccount@gmail.com
Subject: test
Message-ID: <ed6307c2c9504e8ba9ec21f073d5f863@mydomain.com>
X-Sender: support@mydomain.com
User-Agent: Roundcube Webmail/0.9.5
X-AntiAbuse: This header was added to track abuse, please include it with any abuse report
X-AntiAbuse: Primary Hostname - lin9.maindomain10.net
X-AntiAbuse: Original Domain - gmail.com
X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse: Sender Address Domain - mydomain.com
X-Get-Message-Sender-Via: lin9.maindomain10.net: authenticated_id: support@mydomain.com                                                                                                                                                                                                                                                                   

Round-Cube无垃圾邮件。 问题的主要区别是什么?

谢谢:)

1 个答案:

答案 0 :(得分:0)

5.2.4非常陈旧且有缺陷 - 你需要更新到latest PHPMailer from GitHub