phpMailer失败的身份验证

时间:2014-05-29 20:17:12

标签: php email authentication sendmail phpmailer

我刚刚设置了一封自动发送给用户的电子邮件。

NSlookup的

这是域的 NSLookup 详细信息:

sballiance.co.uk name server ns2.mainnameserver.com.
sballiance.co.uk mail is handled by 0 sballiance-co-uk.mail.protection.outlook.com.
sballiance.co.uk descriptive text "v=spf1 include:spf.protection.outlook.com -all"
sballiance.co.uk has address 176.32.230.12
sballiance.co.uk descriptive text "MS=ms71078976"
sballiance.co.uk has SOA record ns.mainnameserver.com. hostmaster.mainnameserver.com. 2014032747 86400 604800 2419200 10800
sballiance.co.uk name server ns.mainnameserver.com.

phpMailer设置

以下是 phpMailer 设置的重要细节:

public $Host          = 'sballiance-co-uk.mail.protection.outlook.com';
public $Port          = 465; //I've kept this to default(?)
public $SMTPSecure    = '';
public $SMTPAuth      = true; //Default is false
public $Username      = 'no-reply@sballiance.co.uk';
public $Password      = '%password%'; //this username/password combination has been set up for that email address in my cPanel equivalent (and works when checking webmail)

以下是发送邮件的实际功能:

function sendMail($email,$username,$subject,$content){
    include "mail/class.phpmailer.php";
    include "mail/class.pop3.php";
    include "mail/class.smtp.php";

    $mail             = new PHPMailer();
    $body             = $content;

    $mail->SetFrom('no-reply@sballiance.co.uk', 'SB Alliance');

    $mail->AddReplyTo('no-reply@sballiance.co.uk', 'SB Alliance');

    $address = $email;
    $mail->AddAddress($address, $username);

    $mail->Subject    = $subject;

    $mail->AltBody    = 'This email requires a compatible HTML email reader';

    $mail->MsgHTML($body);

    if(!$mail->Send()) {
        return "Mailer Error: " . $mail->ErrorInfo;
    } else {
        return "sent";
    }
}

我还尝试将$Host更改为其他似乎相关的内容,例如mail.sballiance.co.uk(用于网络邮件服务)和outlook.office365.com,但无济于事。

客户端报告

出现的错误如下所示:

Be careful! This sender has failed our fraud detection checks.

和标题如下:

x-store-info:sbevkl2QZR7OXo7WID5ZcdV2tiiWGqTnv73VPHTe3HZillThz1CwMFmvE6RyGLdUgeYElVvsR9ZinU/JS1XJwJa/Khp9v2l3PYv0uCTAYlo0Nw1MBZNhWNveRqIhDM6d34x4hW3u5wA=
Authentication-Results: hotmail.com; spf=fail (sender IP is 79.170.43.23) smtp.mailfrom=no-reply@sballiance.co.uk; dkim=none header.d=sballiance.co.uk; x-hmca=fail header.id=no-reply@sballiance.co.uk
X-SID-PRA: no-reply@sballiance.co.uk
X-AUTH-Result: FAIL
X-SID-Result: FAIL
X-Message-Status: n:n
X-Message-Delivery: Vj0xLjE7dXM9MDtsPTA7YT0xO0Q9MTtHRD0xO1NDTD0w
X-Message-Info: NhFq/7gR1vR7v/qBzEYftopex6RvS/TlaqofkDjfprtVulohbgulVNuxNJEURduxeriG1vH3EjyGlkDh8pik4NJPpySLFvCsUWX/ZpVUFHceF+K8uNNco1TVASfjWcYNog2EKJ3v8ua8pnX3qRJRxa1wxY3PGztq0u1pYpCfb8zHPYLkdXhR07X/MA1HZDyMtY3rLSQs6CMI3Oo7ANz2/tJ+D0LMcw+i
Received: from mailscan1.extendcp.co.uk ([79.170.43.23]) by SNT004-MC1F56.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.22678);
    Thu, 29 May 2014 12:42:44 -0700
Received: from lb1.hi.local ([10.0.1.197] helo=mailscan0.hi.local)
    by mailscan-g65.hi.local with esmtp (Exim 4.80.1)
    (envelope-from <no-reply@sballiance.co.uk>)
    id 1Wq6Dq-0000qO-Rj
    for %myemailaddress%; Thu, 29 May 2014 20:42:42 +0100
Received: from lb1.hi.local ([10.0.1.197] helo=web12.extendcp.co.uk)
    by mailscan0.hi.local with esmtps (UNKNOWN:DHE-RSA-AES256-GCM-SHA384:256)
    (Exim 4.80.1)
    (envelope-from <no-reply@sballiance.co.uk>)
    id 1Wq6Dp-000109-4y
    for %myemailaddress%; Thu, 29 May 2014 20:42:42 +0100
Received: from sballiance.co.uk by web12.extendcp.co.uk with local (Exim 4.80.1)
    (envelope-from <no-reply@sballiance.co.uk>)
    id 1Wq6Do-0005SG-Vb
    for %myemailaddress%; Thu, 29 May 2014 20:42:41 +0100

如何避免我的电子邮件验证失败?

此外,如果需要任何其他信息,请告诉我,以便我在问题上提供更多帮助。

1 个答案:

答案 0 :(得分:0)

您有一个SPF记录,您发送的服务器未列在其中,因此未通过SPF检查:

spf=fail (sender IP is 79.170.43.23)

您可以通过将此子句添加到SPF记录来解决此问题:

ip4:79.170.43.23

或等效的a条款。

你的配置有点不对 - 事实上我很惊讶它正在按原样运作:

public $SMTPSecure    = '';

应该是:

public $SMTPSecure    = 'ssl';

除此之外,您已经将代码基于一个旧示例,并且您将包含可能不必要的类。将您的代码基于up to date examplelatest PHPMailer