启用出站tls后SMTP无法发送

时间:2018-10-17 09:53:25

标签: php smtp phpmailer windows-server-2012-r2

我正在尝试通过 windows smtp服务器发送电子邮件,并且它也已成功发送到name@gmail.com(垃圾邮件文件夹)未加密

所以我尝试在出站安全性上启用tls ,但是在此之后,它无法发送,php邮件程序显示结果为成功,但电子邮件甚至无法发送到垃圾邮件文件夹。
(smtp域具有SSL。)

  

邮件结果

    2018-10-17 09:37:18 SERVER -> CLIENT: 220 www.domain.com Microsoft ESMTP MAIL Service, Version: 8.5.9600.16384 ready at Wed, 17 Oct 2018 09:37:18 +0000 
    2018-10-17 09:37:18 CLIENT -> SERVER: EHLO domain.com
    2018-10-17 09:37:18 SERVER -> CLIENT: 250-www.domain.com Hello [93.115.29.4]250-AUTH NTLM250-TURN250-SIZE 2097152250-ETRN250-PIPELINING250-DSN250-ENHANCEDSTATUSCODES250-8bitmime250-BINARYMIME250-CHUNKING250-VRFY250-TLS250-STARTTLS250 OK
    2018-10-17 09:37:18 CLIENT -> SERVER: STARTTLS
    2018-10-17 09:37:18 SERVER -> CLIENT: 220 2.0.0 SMTP server ready
    2018-10-17 09:37:18 CLIENT -> SERVER: EHLO domain.com
    2018-10-17 09:37:18 SERVER -> CLIENT: 250-www.domain.com Hello [93.115.29.4]250-AUTH NTLM LOGIN250-AUTH=LOGIN250-TURN250-SIZE 2097152250-ETRN250-PIPELINING250-DSN250-ENHANCEDSTATUSCODES250-8bitmime250-BINARYMIME250-CHUNKING250-VRFY250 OK
    2018-10-17 09:37:18 CLIENT -> SERVER: MAIL FROM:<admin@domain.com>
    2018-10-17 09:37:18 SERVER -> CLIENT: 250 2.1.0 admin@domain.com....Sender OK
    2018-10-17 09:37:18 CLIENT -> SERVER: RCPT TO:<name@gmail.com>
    2018-10-17 09:37:18 SERVER -> CLIENT: 250 2.1.5 name@gmail.com 
    2018-10-17 09:37:18 CLIENT -> SERVER: DATA
    2018-10-17 09:37:18 SERVER -> CLIENT: 354 Start mail input; end with 
    <CRLF>
    .
    <CRLF>
    2018-10-17 09:37:18 CLIENT -> SERVER: Date: Wed, 17 Oct 2018 10:37:18 +0100
    2018-10-17 09:37:18 CLIENT -> SERVER: To: John Doe <name@gmail.com>
    2018-10-17 09:37:18 CLIENT -> SERVER: From: First Last <admin@domain.com>
    2018-10-17 09:37:18 CLIENT -> SERVER: Reply-To: First Last <admin@domain.com>
    2018-10-17 09:37:18 CLIENT -> SERVER: Subject: SMTP test
    2018-10-17 09:37:18 CLIENT -> SERVER: Message-ID: <ZFfehX5eAzGcQXThiqrpfDoWeDWBJgUQwYy0COFA8TA@domain.com>
    2018-10-17 09:37:18 CLIENT -> SERVER: X-Mailer: PHPMailer 6.0.5 (https://github.com/PHPMailer/PHPMailer)
    2018-10-17 09:37:18 CLIENT -> SERVER: MIME-Version: 1.0
    2018-10-17 09:37:18 CLIENT -> SERVER: Content-Type: multipart/alternative;
    2018-10-17 09:37:18 CLIENT -> SERVER: boundary="b1_ZFfehX5eAzGcQXThiqrpfDoWeDWBJgUQwYy0COFA8TA"
    2018-10-17 09:37:18 CLIENT -> SERVER: Content-Transfer-Encoding: 8bit
    2018-10-17 09:37:18 CLIENT -> SERVER: 
    2018-10-17 09:37:18 CLIENT -> SERVER: This is a multi-part message in MIME format.
    2018-10-17 09:37:18 CLIENT -> SERVER: --b1_ZFfehX5eAzGcQXThiqrpfDoWeDWBJgUQwYy0COFA8TA
    2018-10-17 09:37:18 CLIENT -> SERVER: Content-Type: text/plain; charset=us-ascii
    2018-10-17 09:37:18 CLIENT -> SERVER: 
    2018-10-17 09:37:18 CLIENT -> SERVER: This is a plain-text message body
    2018-10-17 09:37:18 CLIENT -> SERVER: 
    2018-10-17 09:37:18 CLIENT -> SERVER: --b1_ZFfehX5eAzGcQXThiqrpfDoWeDWBJgUQwYy0COFA8TA
    2018-10-17 09:37:18 CLIENT -> SERVER: Content-Type: text/html; charset=us-ascii
    2018-10-17 09:37:18 CLIENT -> SERVER: 
    2018-10-17 09:37:18 CLIENT -> SERVER: OK
    2018-10-17 09:37:18 CLIENT -> SERVER: 
    2018-10-17 09:37:18 CLIENT -> SERVER: 
    2018-10-17 09:37:18 CLIENT -> SERVER: --b1_ZFfehX5eAzGcQXThiqrpfDoWeDWBJgUQwYy0COFA8TA--
    2018-10-17 09:37:18 CLIENT -> SERVER: 
    2018-10-17 09:37:18 CLIENT -> SERVER: .
    2018-10-17 09:37:18 SERVER -> CLIENT: 250 2.6.0 <ZFfehX5eAzGcQXThiqrpfDoWeDWBJgUQwYy0COFA8TA@domain.com> Queued mail for delivery
    2018-10-17 09:37:18 CLIENT -> SERVER: QUIT
    2018-10-17 09:37:18 SERVER -> CLIENT: 221 2.0.0 www.domain.com Service closing transmission channel
    Message sent!
  

邮件代码

$mail = new PHPMailer;
$mail->isSMTP()
$mail->SMTPDebug = 2;
$mail->Host = 'www.domain.com';
$mail->Port = 25;
$mail->SMTPSecure = 'tls';
$mail->SMTPAuth = false;
$mail->AuthType=PLAIN;
$mail->Username = "admin@domain.com";
$mail->Password = "pass";
$mail->SMTPOptions = array(
        'ssl' => array(
            'verify_peer' => false,
            'verify_peer_name' => false,
            'allow_self_signed' => true
        )
    );
$mail->setFrom('admin@domain.com', 'First Last');
$mail->addReplyTo('admin@domain.com', 'First Last');
$mail->addAddress('name@gmail.com', 'John Doe');
$mail->Subject = 'SMTP test';
$mail->msgHTML("OK");
$mail->AltBody = 'This is a plain-text message body';
if (!$mail->send()) {
    echo "Mailer Error: " . $mail->ErrorInfo;
} else {
    echo "Message sent!";    
}
  

SMTP设置

enter image description here

在tls之前,请检查发送到垃圾邮件文件夹的电子邮件。

enter image description here

在tls之后检查没有发送电子邮件。请帮助我通过SMTP发送加密的电子邮件。谢谢。

0 个答案:

没有答案