外部 SMTP 提供服务器 -> 客户端:250 确定:排队CA053776D18邮件未发送


External SMTP giving SERVER -> CLIENT: 250 Ok: queued as CA053776D18 Mail Not Sent

我有一个html表单,它使用php将电子邮件中的表单数据发送到外部邮件服务器。我的代码是这样的(变量更改以保护无辜者):

<?php
//$ckNotify = $_POST['ckNotify'];
$ckNotify = isset($_POST['ckNotify']) && $_POST['ckNotify'] ? "Please sign me up for Email Notifications" : "NO";
$ckUnsubscribe = isset($_POST['ckUnsubscribe']) && $_POST['ckUnsubscribe'] ? "Plese unsubscribe me from Email Notifications" : "Does Not Apply to this instance";
$name = $_POST['name'];
$visitor_email = $_POST['email'];
$message = $_POST['message'];
if (!empty($_POST)) //Validate first
{
    if (empty($name) || empty($visitor_email)) {
        echo "Name and email are mandatory!";
        exit;
    }
}
if (IsInjected($visitor_email)) {
    echo "Bad email value!";
    exit;
}
date_default_timezone_set('America/Chicago');
require_once 'PHPMailerAutoload.php';
//Create a new PHPMailer instance
$mail = new PHPMailer;
//Tell PHPMailer to use SMTP
$mail->isSMTP();
//Enable SMTP debugging
// 0 = off (for production use)
// 1 = client messages
// 2 = client and server messages
// 3 = verbose messages
$mail->SMTPDebug = 3;
//Ask for HTML-friendly debug output
$mail->Debugoutput = 'html';
//Set the hostname of the mail server
$mail->Host = "74.84.86.134";
//Set the SMTP port number - likely to be 25, 465 or 587
$mail->Port = 25;
//Whether to use SMTP authentication
$mail->SMTPAuth = false;
//Set who the message is to be sent from
$mail->setFrom('miket@extsmtp.net', 'Mike Tolliver');
//Set an alternative reply-to address
$mail->addReplyTo('miket@extsmtp.net', 'Mike Tolliver');
//Set who the message is to be sent to
$mail->addAddress('miket@extsmtp.net', 'Mike Tolliver');
//Set the subject line
$mail->Subject = 'New Form Submission';
//Get message contents from form and place in body of email as basic plain-test
$body = "Email Notifications: $ckNotify
UnSubscribe User: $ckUnsubscribe
Name: $name
Email: $visitor_email
Message: $message";
$mail->MsgHTML($body);
//Replace the plain text body with one created manually
//$mail->AltBody = 'This is a plain-text message body';
//Attach an image file
//$mail->addAttachment('images/phpmailer_mini.png');
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
//done - redirect to thank-you page if no errors
if (!$mail->Send()) {
    header('Location: ThankYou.html');
//echo "Mail Sent Successfully";
} else {
    echo "Mail Not Sent";
}
// Function to validate against any email injection attempts
function IsInjected($str)
{
    $injections = array(
        '('n+)',
        '('r+)',
        '('t+)',
        '(%0A+)',
        '(%0D+)',
        '(%08+)',
        '(%09+)'
    );
    $inject = join('|', $injections);
    $inject = "/$inject/i";
    if (preg_match($inject, $str)) {
        return true;
    } else {
        return false;
    }
}

但是我在提交表单并转到 php 页面后得到此输出:

    2015-02-03 23:18:21 Connection: opening to 74.84.86.134:25, t=10, opt=array ( ) 
2015-02-03 23:18:21 Connection: opened 
2015-02-03 23:18:21 SERVER -> CLIENT: 220 barracuda.platinum-corp.com ESMTP (b35451cd44f584ec6f962de7068c7240) 
2015-02-03 23:18:21 CLIENT -> SERVER: EHLO www.extsmtp.net 
2015-02-03 23:18:21 SERVER -> CLIENT: 250-barracuda.platinum-corp.com Hello www.extsmtp.net [173.0.129.93], pleased to meet you 250-SIZE 100000000 250-STARTTLS 250-PIPELINING 250-8BITMIME 250 HELP 
2015-02-03 23:18:21 CLIENT -> SERVER: MAIL FROM: 
2015-02-03 23:18:21 SERVER -> CLIENT: 250 Sender OK 
2015-02-03 23:18:21 CLIENT -> SERVER: RCPT TO: 
2015-02-03 23:18:21 SERVER -> CLIENT: 250 Recipient OK 
2015-02-03 23:18:21 CLIENT -> SERVER: DATA 
2015-02-03 23:18:21 SERVER -> CLIENT: 354 Start mail input; end with . 
2015-02-03 23:18:21 CLIENT -> SERVER: Date: Tue, 3 Feb 2015 17:18:21 -0600 
2015-02-03 23:18:21 CLIENT -> SERVER: Return-Path: miket@extsmtp.net 
2015-02-03 23:18:21 CLIENT -> SERVER: To: Mike Tolliver 
2015-02-03 23:18:21 CLIENT -> SERVER: From: Mike Tolliver 
2015-02-03 23:18:21 CLIENT -> SERVER: Reply-to: Mike Tolliver 
2015-02-03 23:18:21 CLIENT -> SERVER: Subject: New Form Submission 
2015-02-03 23:18:21 CLIENT -> SERVER: Message-ID: <718f56184800b47dd0a9327e8003f4f1@www.extsmtp.net> 
2015-02-03 23:18:21 CLIENT -> SERVER: X-Priority: 3 
2015-02-03 23:18:21 CLIENT -> SERVER: X-Mailer: PHPMailer 5.2 (http://code.google.com/a/apache-extras.org/p/phpmailer/) 
2015-02-03 23:18:21 CLIENT -> SERVER: MIME-Version: 1.0 
2015-02-03 23:18:21 CLIENT -> SERVER: Content-Type: multipart/alternative; 
2015-02-03 23:18:21 CLIENT -> SERVER: boundary="b1_718f56184800b47dd0a9327e8003f4f1" 
2015-02-03 23:18:21 CLIENT -> SERVER: 
2015-02-03 23:18:21 CLIENT -> SERVER: 
2015-02-03 23:18:21 CLIENT -> SERVER: --b1_718f56184800b47dd0a9327e8003f4f1 
2015-02-03 23:18:21 CLIENT -> SERVER: Content-Type: text/plain; charset="iso-8859-1" 
2015-02-03 23:18:21 CLIENT -> SERVER: Content-Transfer-Encoding: 8bit 
2015-02-03 23:18:21 CLIENT -> SERVER: 
2015-02-03 23:18:21 CLIENT -> SERVER: To view the message, please use an HTML compatible email viewer! 
2015-02-03 23:18:21 CLIENT -> SERVER: 
2015-02-03 23:18:21 CLIENT -> SERVER: 
2015-02-03 23:18:21 CLIENT -> SERVER: --b1_718f56184800b47dd0a9327e8003f4f1 
2015-02-03 23:18:21 CLIENT -> SERVER: Content-Type: text/html; charset="iso-8859-1" 
2015-02-03 23:18:21 CLIENT -> SERVER: Content-Transfer-Encoding: 8bit 
2015-02-03 23:18:21 CLIENT -> SERVER: 
2015-02-03 23:18:21 CLIENT -> SERVER: Email Notifications: Please sign me up for Email Notifications 
2015-02-03 23:18:21 CLIENT -> SERVER: UnSubscribe User: Does Not Apply to this instance 
2015-02-03 23:18:21 CLIENT -> SERVER: Name: Joyce Small 
2015-02-03 23:18:21 CLIENT -> SERVER: Email: jsmall@somewhere.net 
2015-02-03 23:18:21 CLIENT -> SERVER: Message: Test message using external smtp settings 
2015-02-03 23:18:21 CLIENT -> SERVER: 2015-02-03 23:18:21   CLIENT -> SERVER: 
2015-02-03 23:18:21 CLIENT -> SERVER: 
2015-02-03 23:18:21 CLIENT -> SERVER: --b1_718f56184800b47dd0a9327e8003f4f1-- 
2015-02-03 23:18:21 CLIENT -> SERVER: 
2015-02-03 23:18:21 CLIENT -> SERVER: . 
2015-02-03 23:18:21 SERVER -> CLIENT: 250 Ok: queued as CA053776D18 Mail Not Sent

看起来对我来说一切都很好(但话又说回来,我是 php 的新手),除了最后的"邮件未发送"。有谁知道为什么没有发送邮件?根据我非常有限的知识,似乎外部 smtp 服务器没有中继 - 但我知道什么。感谢您的任何帮助!

您尝试通过的远程主机 (74.84.86.134) 将反转为 spamfilter.coralville.platinum-corp.com。 我假设这是您尝试发送到的域的MX(否则您可能不会像使用SMTP会话那样走得那么远)。 尽管如此,此远程主机似乎正在接受来自您的 PHP 应用程序的消息,但在收到消息后决定您不是合法邮件发送者,因此"邮件未发送"消息。

要检查从您的应用程序

发送的邮件是否存在一个明显的问题,会导致其他邮件服务器认为它是垃圾邮件,请尝试从您的应用程序向 check-auth@verifier.port25.com 发送邮件。这项服务将进行大量检查,您将获得包含大量信息的报告,例如服务器的DNS是否正确正向和反向,服务器的IP是否在任何黑名单上,如果您的SPF记录有问题,等等。

或者,更简单的解决方案可能是通过众所周知的 SMTP 中继(如 smtp.gmail.com、SendGrid 等)中继这些传出邮件。