duandai2178 2014-05-29 20:17
浏览 82

phpMailer失败的身份验证

I've just set up an automated email that delivers a message to the user.

NSlookup

This is the NSLookup details for the domain:

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 Setup

Here are important details for my phpMailer setup:

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)

Here is the actual function for sending mail:

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";
    }
}

I have also tried changing the $Host to others that seem to be relevant, such as mail.sballiance.co.uk (which is for the webmail service) and outlook.office365.com but to no avail.

Client-Side Reports

The error that comes up looks like this:

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

and the headers like this:

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

What can I do to avoid my emails failing authentication?

Also, if any other information is required, let me know so that I can be more helpful in my question.

  • 写回答

1条回答 默认 最新

  • doutan1875 2015-07-01 10:19
    关注

    You have an SPF record, the server you are sending from is not listed in it, so it's failing an SPF check:

    spf=fail (sender IP is 79.170.43.23)
    

    You could fix this by adding this clause to your SPF record:

    ip4:79.170.43.23
    

    or an equivalent a clause.

    Your config is slightly wrong - in fact I'm surprised it's working at all as-is:

    public $SMTPSecure    = '';
    

    It should be:

    public $SMTPSecure    = 'ssl';
    

    On top of that you've based your code on an old example, and you're including classes that may not be necessary. Base your code on an up to date example and latest PHPMailer.

    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度