简体   繁体   中英

GoDaddy PHPMailer Success but no Email (No errors either in Debug Mode)

Yet another dilemma with using PHPMailer in conjunction with GoDaddy hosting. The following configuration functioned for at least last few months with no issues, however, out of nowhere, the e-mails are no longer been sent despite having no errors in Debug mode and 'Success' as a Server response. In fact, please take a look at the log file, perhaps, I am missing something obvious?

$mail = new PHPMailer. 
$mail->IsSMTP();
$mail->SMTPDebug = 4; 


$mail->Host = 'localhost';
$mail->Port = 25;
$mail->SMTPAuth = false;
$mail->SMTPSecure = false;
$mail->SMTPAutoTLS = false;
$mail->SMTPSecure = false;

Debug result:

2016-12-22 12:12:40 Connection: opening to localhost:25, timeout=300, options=array (
                                      )
2016-12-22 12:12:40 Connection: opened
2016-12-22 12:12:45 SMTP -> get_lines(): $data was ""
2016-12-22 12:12:45 SMTP -> get_lines(): $str is "220-n3plcpnl0096.prod.ams3.secureserver.net ESMTP Exim 4.87 #1 Thu, 22 Dec 2016 05:12:45 -0700 
                                      "
2016-12-22 12:12:45 SMTP -> get_lines(): $data is "220-n3plcpnl0096.prod.ams3.secureserver.net ESMTP Exim 4.87 #1 Thu, 22 Dec 2016 05:12:45 -0700 
                                      "
2016-12-22 12:12:45 SMTP -> get_lines(): $data was "220-n3plcpnl0096.prod.ams3.secureserver.net ESMTP Exim 4.87 #1 Thu, 22 Dec 2016 05:12:45 -0700 
                                      "
2016-12-22 12:12:45 SMTP -> get_lines(): $str is "220-We do not authorize the use of this system to transport unsolicited, 
                                      "
2016-12-22 12:12:45 SMTP -> get_lines(): $data is "220-n3plcpnl0096.prod.ams3.secureserver.net ESMTP Exim 4.87 #1 Thu, 22 Dec 2016 05:12:45 -0700 
                                      220-We do not authorize the use of this system to transport unsolicited, 
                                      "
2016-12-22 12:12:45 SMTP -> get_lines(): $data was "220-n3plcpnl0096.prod.ams3.secureserver.net ESMTP Exim 4.87 #1 Thu, 22 Dec 2016 05:12:45 -0700 
                                      220-We do not authorize the use of this system to transport unsolicited, 
                                      "
2016-12-22 12:12:45 SMTP -> get_lines(): $str is "220 and/or bulk e-mail.
                                      "
2016-12-22 12:12:45 SMTP -> get_lines(): $data is "220-n3plcpnl0096.prod.ams3.secureserver.net ESMTP Exim 4.87 #1 Thu, 22 Dec 2016 05:12:45 -0700 
                                      220-We do not authorize the use of this system to transport unsolicited, 
                                      220 and/or bulk e-mail.
                                      "
2016-12-22 12:12:45 SERVER -> CLIENT: 220-n3plcpnl0096.prod.ams3.secureserver.net ESMTP Exim 4.87 #1 Thu, 22 Dec 2016 05:12:45 -0700 
                                      220-We do not authorize the use of this system to transport unsolicited, 
                                      220 and/or bulk e-mail.
2016-12-22 12:12:45 CLIENT -> SERVER: EHLO www.#####.com
2016-12-22 12:12:45 SMTP -> get_lines(): $data was ""
2016-12-22 12:12:45 SMTP -> get_lines(): $str is "250-n3plcpnl0096.prod.ams3.secureserver.net Hello www.#####.com [127.0.0.1]
                                      "
2016-12-22 12:12:45 SMTP -> get_lines(): $data is "250-n3plcpnl0096.prod.ams3.secureserver.net Hello www.#####.com [127.0.0.1]
                                      "
2016-12-22 12:12:45 SMTP -> get_lines(): $data was "250-n3plcpnl0096.prod.ams3.secureserver.net Hello www.#####.com [127.0.0.1]
                                      "
2016-12-22 12:12:45 SMTP -> get_lines(): $str is "250-SIZE 52428800
                                      "
2016-12-22 12:12:45 SMTP -> get_lines(): $data is "250-n3plcpnl0096.prod.ams3.secureserver.net Hello www.#####.com [127.0.0.1]
                                      250-SIZE 52428800
                                      "
2016-12-22 12:12:45 SMTP -> get_lines(): $data was "250-n3plcpnl0096.prod.ams3.secureserver.net Hello www.#####.com [127.0.0.1]
                                      250-SIZE 52428800
                                      "
2016-12-22 12:12:45 SMTP -> get_lines(): $str is "250-8BITMIME
                                      "
2016-12-22 12:12:45 SMTP -> get_lines(): $data is "250-n3plcpnl0096.prod.ams3.secureserver.net Hello www.#####.com [127.0.0.1]
                                      250-SIZE 52428800
                                      250-8BITMIME
                                      "
2016-12-22 12:12:45 SMTP -> get_lines(): $data was "250-n3plcpnl0096.prod.ams3.secureserver.net Hello www.#####.com [127.0.0.1]
                                      250-SIZE 52428800
                                      250-8BITMIME
                                      "
2016-12-22 12:12:45 SMTP -> get_lines(): $str is "250-PIPELINING
                                      "
2016-12-22 12:12:45 SMTP -> get_lines(): $data is "250-n3plcpnl0096.prod.ams3.secureserver.net Hello www.#####.com [127.0.0.1]
                                      250-SIZE 52428800
                                      250-8BITMIME
                                      250-PIPELINING
                                      "
2016-12-22 12:12:45 SMTP -> get_lines(): $data was "250-n3plcpnl0096.prod.ams3.secureserver.net Hello www.#####.com [127.0.0.1]
                                      250-SIZE 52428800
                                      250-8BITMIME
                                      250-PIPELINING
                                      "
2016-12-22 12:12:45 SMTP -> get_lines(): $str is "250-AUTH PLAIN LOGIN
                                      "
2016-12-22 12:12:45 SMTP -> get_lines(): $data is "250-n3plcpnl0096.prod.ams3.secureserver.net Hello www.#####.com [127.0.0.1]
                                      250-SIZE 52428800
                                      250-8BITMIME
                                      250-PIPELINING
                                      250-AUTH PLAIN LOGIN
                                      "
2016-12-22 12:12:45 SMTP -> get_lines(): $data was "250-n3plcpnl0096.prod.ams3.secureserver.net Hello www.#####.com [127.0.0.1]
                                      250-SIZE 52428800
                                      250-8BITMIME
                                      250-PIPELINING
                                      250-AUTH PLAIN LOGIN
                                      "
2016-12-22 12:12:45 SMTP -> get_lines(): $str is "250-STARTTLS
                                      "
2016-12-22 12:12:45 SMTP -> get_lines(): $data is "250-n3plcpnl0096.prod.ams3.secureserver.net Hello www.#####.com [127.0.0.1]
                                      250-SIZE 52428800
                                      250-8BITMIME
                                      250-PIPELINING
                                      250-AUTH PLAIN LOGIN
                                      250-STARTTLS
                                      "
2016-12-22 12:12:45 SMTP -> get_lines(): $data was "250-n3plcpnl0096.prod.ams3.secureserver.net Hello www.#####.com [127.0.0.1]
                                      250-SIZE 52428800
                                      250-8BITMIME
                                      250-PIPELINING
                                      250-AUTH PLAIN LOGIN
                                      250-STARTTLS
                                      "
2016-12-22 12:12:45 SMTP -> get_lines(): $str is "250 HELP
                                      "
2016-12-22 12:12:45 SMTP -> get_lines(): $data is "250-n3plcpnl0096.prod.ams3.secureserver.net Hello www.#####.com [127.0.0.1]
                                      250-SIZE 52428800
                                      250-8BITMIME
                                      250-PIPELINING
                                      250-AUTH PLAIN LOGIN
                                      250-STARTTLS
                                      250 HELP
                                      "
2016-12-22 12:12:45 SERVER -> CLIENT: 250-n3plcpnl0096.prod.ams3.secureserver.net Hello www.#####.com [127.0.0.1]
                                      250-SIZE 52428800
                                      250-8BITMIME
                                      250-PIPELINING
                                      250-AUTH PLAIN LOGIN
                                      250-STARTTLS
                                      250 HELP
2016-12-22 12:12:45 CLIENT -> SERVER: MAIL FROM:<info@#####.com>
2016-12-22 12:12:45 SMTP -> get_lines(): $data was ""
2016-12-22 12:12:45 SMTP -> get_lines(): $str is "250 OK
                                      "
2016-12-22 12:12:45 SMTP -> get_lines(): $data is "250 OK
                                      "
2016-12-22 12:12:45 SERVER -> CLIENT: 250 OK
2016-12-22 12:12:45 CLIENT -> SERVER: RCPT TO:<info@#####.com>
2016-12-22 12:12:45 SMTP -> get_lines(): $data was ""
2016-12-22 12:12:45 SMTP -> get_lines(): $str is "250 Accepted
                                      "
2016-12-22 12:12:45 SMTP -> get_lines(): $data is "250 Accepted
                                      "
2016-12-22 12:12:45 SERVER -> CLIENT: 250 Accepted
2016-12-22 12:12:45 CLIENT -> SERVER: DATA
2016-12-22 12:12:45 SMTP -> get_lines(): $data was ""
2016-12-22 12:12:45 SMTP -> get_lines(): $str is "354 Enter message, ending with "." on a line by itself
                                      "
2016-12-22 12:12:45 SMTP -> get_lines(): $data is "354 Enter message, ending with "." on a line by itself
                                      "
2016-12-22 12:12:45 SERVER -> CLIENT: 354 Enter message, ending with "." on a line by itself
2016-12-22 12:12:45 CLIENT -> SERVER: Date: Thu, 22 Dec 2016 12:12:40 +0000
2016-12-22 12:12:45 CLIENT -> SERVER: To: info@#####.com
2016-12-22 12:12:45 CLIENT -> SERVER: From: Anonymous <info@#####.com>
2016-12-22 12:12:45 CLIENT -> SERVER: Reply-To: Anonymous <info@#####.com>
2016-12-22 12:12:45 CLIENT -> SERVER: Subject: General Enquiry
2016-12-22 12:12:45 CLIENT -> SERVER: Message-ID: <4784799123b2e08d2153a654b78eb1d0@www.#####.com>
2016-12-22 12:12:45 CLIENT -> SERVER: X-Mailer: PHPMailer 5.2.10 (https://github.com/PHPMailer/PHPMailer/)
2016-12-22 12:12:45 CLIENT -> SERVER: MIME-Version: 1.0
2016-12-22 12:12:45 CLIENT -> SERVER: Content-Type: text/html; charset=UTF-8
2016-12-22 12:12:45 CLIENT -> SERVER: Content-Transfer-Encoding: 8bit
2016-12-22 12:12:45 CLIENT -> SERVER:
2016-12-22 12:12:45 CLIENT -> SERVER: Full Name: Anonymous<br>
2016-12-22 12:12:45 CLIENT -> SERVER: Email address: info@#####.com<br>
2016-12-22 12:12:45 CLIENT -> SERVER: Phone: ##########<br>
2016-12-22 12:12:45 CLIENT -> SERVER:
2016-12-22 12:12:45 CLIENT -> SERVER: .
2016-12-22 12:12:45 SMTP -> get_lines(): $data was ""
2016-12-22 12:12:45 SMTP -> get_lines(): $str is "250 OK id=1cK2En-001yR0-3J
                                      "
2016-12-22 12:12:45 SMTP -> get_lines(): $data is "250 OK id=1cK2En-001yR0-3J
                                      "
2016-12-22 12:12:45 SERVER -> CLIENT: 250 OK id=1cK2En-001yR0-3J
2016-12-22 12:12:45 CLIENT -> SERVER: QUIT
2016-12-22 12:12:45 SMTP -> get_lines(): $data was ""
2016-12-22 12:12:45 SMTP -> get_lines(): $str is "221 n3plcpnl0096.prod.ams3.secureserver.net closing connection
                                      "
2016-12-22 12:12:45 SMTP -> get_lines(): $data is "221 n3plcpnl0096.prod.ams3.secureserver.net closing connection
                                      "
2016-12-22 12:12:45 SERVER -> CLIENT: 221 n3plcpnl0096.prod.ams3.secureserver.net closing connection
2016-12-22 12:12:45 Connection: closed
{"response":"success"}

Here is the actual PHP file:

<?php

session_cache_limiter('nocache');
header('Expires: ' . gmdate('r', 0));
header('Content-type: application/json');

// Include PHPMailer class
include("PHPMailer/PHPMailerAutoload.php");


$to_address = "info@#####.com"; 



// Verify if data has been entered
if(!empty($_POST['email']) || !empty($_POST['fullname']) || !empty($_POST['phone'])) {

    $subjectline = $_POST['subjectline'];
    $email = $_POST['email'];
    $fullname = $_POST['fullname'];
    $phone = $_POST['phone'];

    // Configure the fields list that you want to receive on the email.
    $fields = array(
        0 => array(
            'text' => 'Full Name',
            'val' => $_POST['fullname']
        ),
        1 => array(
            'text' => 'Email address',
            'val' => $_POST['email']
        ),
        2 => array(
            'text' => 'Phone',
            'val' => $_POST['phone']
        )
    );


    $message = "";
    foreach($fields as $field) {
        $message .= $field['text'].": " . htmlspecialchars($field['val'], ENT_QUOTES) . "<br>\n";
    }


    $mail = new PHPMailer;

    $mail->IsSMTP(); // Set mailer to use SMTP
    $mail->SMTPDebug = 4; 


    $mail->Host = 'localhost';
    $mail->Port = 25;
    $mail->SMTPAuth = false;
    $mail->SMTPSecure = false;
    $mail->SMTPAutoTLS = false;
    $mail->SMTPSecure = false;



    $mail->From = $email;
    $mail->FromName = $fullname;
    $mail->AddAddress($to_address); 
    $mail->AddReplyTo($email, $fullname);


    $mail->IsHTML(true); // Set email format to HTML
    $mail->CharSet = 'UTF-8';

    $mail->Subject = $subjectline;
    $mail->Body    = $message;

    if($mail->Send()) {
        $result = array ('response'=>'success');
    } else {
        $result = array ('response'=>'error' , 'error_message'=> $mail->ErrorInfo);
    }

    echo json_encode($result);

} else {

    $result = array ('response'=>'error' , 'error_message'=>'Data has not been entered');
    echo json_encode($result);

}
?>

SMTPDebug = 4 is too noisy; 2 is enough for this.

This says you're using an old version, so update :

2016-12-22 12:12:45 CLIENT -> SERVER: X-Mailer: PHPMailer 5.2.10 (https://github.com/PHPMailer/PHPMailer/)

Anyway, this is the significant line:

2016-12-22 12:12:45 SERVER -> CLIENT: 250 OK id=1cK2En-001yR0-3J

That says that the message was accepted successfully. PHPMailer's involvement (and any other mailing class) ends here. Next you need to find out where the message is going - first check your spam folder, next ask GoDaddy support to help you trace it, since they won't let you see mail server logs.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM