首页 > 解决方案 > 电子邮件已发送,但未收到,排队等待投递

问题描述

我也将在这里发布,因为我不确定这是否是 PHPMailer 的错误,或者只是我遗漏了一些小细节。

我正在使用来自 OVH 的最新 PHPMailer + PHP7.0 + smtp(电子邮件专业帐户)

描述

看起来我的电子邮件已发送,但我从未收到它.. 没有报告错误,身份验证顺利,一切正常,但最后,邮件排队等待发送,并且永远不会到达接收者.. 你能帮帮我吗? 我错过了什么?这里的“排队等待交货”到底是什么意思?

我将 Gmail 帐户与 PHPMailer 的 Gmail 示例代码一起使用 - 一切正常。然后我切换到其他电子邮件解决方案(OVH)仍然使用相同的代码..但消息没有传递

php

    $mail->isSMTP();
    $mail->SMTPDebug = SMTP::DEBUG_SERVER;
    //Set the hostname of the mail server
    $mail->Host = 'tls://MAIL.SERVER.COM';
    //Set the SMTP port number - likely to be 25, 465 or 587
    $mail->SMTPSecure = 'tls';
    $mail->Port = 587;
    //Whether to use SMTP authentication
    $mail->SMTPAuth = true;
    //Username to use for SMTP authentication
    $mail->Username = $uesr;
    //Password to use for SMTP authentication
    $mail->Password = $pass;
    //Charset
    $mail->CharSet = 'UTF-8';  
    //Set who the message is to be sent from
    $mail->setFrom($uesr, $senderName);
    //Set an alternative reply-to address
    $mail->addReplyTo($uesr, $senderName);
    //Set who the message is to be sent to
    $mail->addAddress('receiver@gmail.com', 'Receiver name');
    //Set the subject line
    $mail->Subject = 'PHPMailer SMTP test';
    //Body
    $mail->Body = 'This is a plain-text message body';
    $mail->AltBody = 'This is a plain-text message body';

调试输出

2021-10-23 13:27:14 SERVER -> CLIENT: 220 MAIL.SERVER Microsoft ESMTP MAIL Service ready at Sat, 23 Oct 2021 15:27:14 +0200
2021-10-23 13:27:14 CLIENT -> SERVER: EHLO support.DOMAINCOM
2021-10-23 13:27:14 SERVER -> CLIENT: 250-MAIL.SERVER Hello [support.DOMAINCOM_IP]250-SIZE 104857600250-PIPELINING250-DSN250-ENHANCEDSTATUSCODES250-STARTTLS250-AUTH GSSAPI NTLM250-8BITMIME250-BINARYMIME250 CHUNKING
2021-10-23 13:27:14 CLIENT -> SERVER: STARTTLS
2021-10-23 13:27:14 SERVER -> CLIENT: 220 2.0.0 SMTP server ready
2021-10-23 13:27:14 CLIENT -> SERVER: EHLO support.DOMAINCOM
2021-10-23 13:27:14 SERVER -> CLIENT: 250-MAIL.SERVER Hello [support.DOMAINCOM_IP]250-SIZE 104857600250-PIPELINING250-DSN250-ENHANCEDSTATUSCODES250-AUTH GSSAPI NTLM LOGIN250-8BITMIME250-BINARYMIME250 CHUNKING
2021-10-23 13:27:14 CLIENT -> SERVER: AUTH LOGIN
2021-10-23 13:27:14 SERVER -> CLIENT: 334 VXNlcm5hbWU6
2021-10-23 13:27:14 CLIENT -> SERVER: [credentials hidden]
2021-10-23 13:27:14 SERVER -> CLIENT: 334 UGFzc3dvcmQ6
2021-10-23 13:27:14 CLIENT -> SERVER: [credentials hidden]
2021-10-23 13:27:15 SERVER -> CLIENT: 235 2.7.0 Authentication successful
2021-10-23 13:27:15 CLIENT -> SERVER: MAIL FROM:<support@domainCOM>
2021-10-23 13:27:15 SERVER -> CLIENT: 250 2.1.0 Sender OK
2021-10-23 13:27:15 CLIENT -> SERVER: RCPT TO:<receiver@GMAIL>
2021-10-23 13:27:15 SERVER -> CLIENT: 250 2.1.5 Recipient OK
2021-10-23 13:27:15 CLIENT -> SERVER: DATA
2021-10-23 13:27:15 SERVER -> CLIENT: 354 Start mail input; end with <CRLF>.<CRLF>
2021-10-23 13:27:15 CLIENT -> SERVER: Date: Sat, 23 Oct 2021 15:27:14 +0200
2021-10-23 13:27:15 CLIENT -> SERVER: To: Receiver <receiver@GMAIL>
2021-10-23 13:27:15 CLIENT -> SERVER: From: Support <support@domainCOM>
2021-10-23 13:27:15 CLIENT -> SERVER: Reply-To: Support <support@domainCOM>
2021-10-23 13:27:15 CLIENT -> SERVER: Subject: PHPMailer SMTP test
2021-10-23 13:27:15 CLIENT -> SERVER: Message-ID: <UOQ5bPRsNXRrq9obGkLu34tlafQssTRCJUL2iCRMDEc@support.domainCOM>
2021-10-23 13:27:15 CLIENT -> SERVER: X-Mailer: PHPMailer 6.5.1 (https://github.com/PHPMailer/PHPMailer)
2021-10-23 13:27:15 CLIENT -> SERVER: MIME-Version: 1.0
2021-10-23 13:27:15 CLIENT -> SERVER: Content-Type: multipart/alternative;
2021-10-23 13:27:15 CLIENT -> SERVER: boundary="b1_UOQ5bPRsNXRrq9obGkLu34tlafQssTRCJUL2iCRMDEc"
2021-10-23 13:27:15 CLIENT -> SERVER: Content-Transfer-Encoding: 8bit
2021-10-23 13:27:15 CLIENT -> SERVER:
2021-10-23 13:27:15 CLIENT -> SERVER: This is a multi-part message in MIME format.
2021-10-23 13:27:15 CLIENT -> SERVER:
2021-10-23 13:27:15 CLIENT -> SERVER: --b1_UOQ5bPRsNXRrq9obGkLu34tlafQssTRCJUL2iCRMDEc
2021-10-23 13:27:15 CLIENT -> SERVER: Content-Type: text/plain; charset=us-ascii
2021-10-23 13:27:15 CLIENT -> SERVER:
2021-10-23 13:27:15 CLIENT -> SERVER: This is a plain-text message body
2021-10-23 13:27:15 CLIENT -> SERVER:
2021-10-23 13:27:15 CLIENT -> SERVER: --b1_UOQ5bPRsNXRrq9obGkLu34tlafQssTRCJUL2iCRMDEc
2021-10-23 13:27:15 CLIENT -> SERVER: Content-Type: text/html; charset=us-ascii
2021-10-23 13:27:15 CLIENT -> SERVER:
2021-10-23 13:27:15 CLIENT -> SERVER: This is a plain-text message body
2021-10-23 13:27:15 CLIENT -> SERVER:
2021-10-23 13:27:15 CLIENT -> SERVER:
2021-10-23 13:27:15 CLIENT -> SERVER: --b1_UOQ5bPRsNXRrq9obGkLu34tlafQssTRCJUL2iCRMDEc--
2021-10-23 13:27:15 CLIENT -> SERVER:
2021-10-23 13:27:15 CLIENT -> SERVER: .
2021-10-23 13:27:15 SERVER -> CLIENT: 250 2.6.0 <UOQ5bPRsNXRrq9obGkLu34tlafQssTRCJUL2iCRMDEc@support.domain.com> [InternalId=17124034609780, Hostname=DAG7EX2.emp2.local] 1909 bytes in 0.157, 11.866 KB/sec Queued mail for delivery
2021-10-23 13:27:15 CLIENT -> SERVER: QUIT
2021-10-23 13:27:15 SERVER -> CLIENT: 221 2.0.0 Service closing transmission channel

标签: emailsmtpphpmailerovh

解决方案


推荐阅读