PHPMailer发送邮件错误SMTP error();

时间:2019-09-18 11:27:38

标签: php phpmailer

发送邮件时出错

我在发送电子邮件时遇到错误,它过去一直像这样工作,但是现在却出现了错误。我不知道错误的确切来源。等待您的帮助,在此先感谢您。

2019-09-18 11:10:59 Connection: opening to mail.lifeloopers.com:587, timeout=300, options=array ( 'ssl' => array ( 'verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true, ),)
        2019-09-18 11:10:59 Connection: opened
        2019-09-18 11:10:59 SMTP INBOUND: "220-refine.guzelhosting.com ESMTP Exim 4.92 #2 Wed, 18 Sep 2019 14:10:58 +0300"
        2019-09-18 11:10:59 SMTP INBOUND: "220-We do not authorize the use of this system to transport unsolicited,"
        2019-09-18 11:10:59 SMTP INBOUND: "220 and/or bulk e-mail."
        2019-09-18 11:10:59 SERVER -> CLIENT: 220-refine.guzelhosting.com ESMTP Exim 4.92 #2 Wed, 18 Sep 2019 14:10:58 +0300 220-We do not authorize the use of this system to transport unsolicited, 220 and/or bulk e-mail.
        2019-09-18 11:10:59 CLIENT -> SERVER: EHLO localhost
        2019-09-18 11:10:59 SMTP INBOUND: "250-refine.guzelhosting.com Hello localhost [85.103.6.117]"
        2019-09-18 11:10:59 SMTP INBOUND: "250-SIZE 52428800"
        2019-09-18 11:10:59 SMTP INBOUND: "250-8BITMIME"
        2019-09-18 11:10:59 SMTP INBOUND: "250-PIPELINING"
        2019-09-18 11:10:59 SMTP INBOUND: "250-AUTH PLAIN LOGIN"
        2019-09-18 11:10:59 SMTP INBOUND: "250-STARTTLS"
        2019-09-18 11:10:59 SMTP INBOUND: "250 HELP"
        2019-09-18 11:10:59 SERVER -> CLIENT: 250-refine.guzelhosting.com Hello localhost [85.103.6.117]250-SIZE 52428800250-8BITMIME250-PIPELINING250-AUTH PLAIN LOGIN250-STARTTLS250 HELP
        2019-09-18 11:10:59 CLIENT -> SERVER: STARTTLS
        2019-09-18 11:10:59 SMTP INBOUND: "220 TLS go ahead"
        2019-09-18 11:10:59 SERVER -> CLIENT: 220 TLS go ahead
        2019-09-18 11:10:59 CLIENT -> SERVER: EHLO localhost
        2019-09-18 11:10:59 SMTP INBOUND: "250-refine.guzelhosting.com Hello localhost [85.103.6.117]"
        2019-09-18 11:10:59 SMTP INBOUND: "250-SIZE 52428800"
        2019-09-18 11:10:59 SMTP INBOUND: "250-8BITMIME"
        2019-09-18 11:10:59 SMTP INBOUND: "250-PIPELINING"
        2019-09-18 11:10:59 SMTP INBOUND: "250-AUTH PLAIN LOGIN"
        2019-09-18 11:10:59 SMTP INBOUND: "250 HELP"
        2019-09-18 11:10:59 SERVER -> CLIENT: 250-refine.guzelhosting.com Hello localhost [85.103.6.117]250-SIZE 52428800250-8BITMIME250-PIPELINING250-AUTH PLAIN LOGIN250 HELP
        2019-09-18 11:10:59 Auth method requested: UNSPECIFIED
        2019-09-18 11:10:59 Auth methods available on the server: PLAIN,LOGIN
        2019-09-18 11:10:59 Requested auth method not available:
        2019-09-18 11:10:59 Auth method selected: LOGIN
        2019-09-18 11:10:59 CLIENT -> SERVER: AUTH LOGIN
        2019-09-18 11:10:59 SMTP INBOUND: "334 VXNlcm5hbWU6"
        2019-09-18 11:10:59 SERVER -> CLIENT: 334 VXNlcm5hbWU6
        2019-09-18 11:10:59 CLIENT -> SERVER: bm9yZXBseUBsaWZlbG9vcGVycy5jb20=
        2019-09-18 11:10:59 SMTP INBOUND: "334 UGFzc3dvcmQ6"
        2019-09-18 11:10:59 SERVER -> CLIENT: 334 UGFzc3dvcmQ6
        2019-09-18 11:10:59 CLIENT -> SERVER: QG5vcmVwbHkxN0A2MQ==
        2019-09-18 11:11:01 SMTP INBOUND: "535 Incorrect authentication data"
        2019-09-18 11:11:01 SERVER -> CLIENT: 535 Incorrect authentication data
        2019-09-18 11:11:01 SMTP ERROR: Password command failed: 535 Incorrect authentication data
        SMTP Error: Could not authenticate.
        2019-09-18 11:11:01 CLIENT -> SERVER: QUIT
        2019-09-18 11:11:01 SMTP INBOUND: "221 refine.guzelhosting.com closing connection"
        2019-09-18 11:11:01 SERVER -> CLIENT: 221 refine.guzelhosting.com closing connection
        2019-09-18 11:11:01 Connection: closed
        SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting2019-09-18 11:10:59 Connection: opening to mail.lifeloopers.com:587, timeout=300, options=array ( 'ssl' => array ( 'verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true, ),)
        2019-09-18 11:10:59 Connection: opened
        2019-09-18 11:10:59 SMTP INBOUND: "220-refine.guzelhosting.com ESMTP Exim 4.92 #2 Wed, 18 Sep 2019 14:10:58 +0300"
        2019-09-18 11:10:59 SMTP INBOUND: "220-We do not authorize the use of this system to transport unsolicited,"
        2019-09-18 11:10:59 SMTP INBOUND: "220 and/or bulk e-mail."
        2019-09-18 11:10:59 SERVER -> CLIENT: 220-refine.guzelhosting.com ESMTP Exim 4.92 #2 Wed, 18 Sep 2019 14:10:58 +0300 220-We do not authorize the use of this system to transport unsolicited, 220 and/or bulk e-mail.
        2019-09-18 11:10:59 CLIENT -> SERVER: EHLO localhost
        2019-09-18 11:10:59 SMTP INBOUND: "250-refine.guzelhosting.com Hello localhost [85.103.6.117]"
        2019-09-18 11:10:59 SMTP INBOUND: "250-SIZE 52428800"
        2019-09-18 11:10:59 SMTP INBOUND: "250-8BITMIME"
        2019-09-18 11:10:59 SMTP INBOUND: "250-PIPELINING"
        2019-09-18 11:10:59 SMTP INBOUND: "250-AUTH PLAIN LOGIN"
        2019-09-18 11:10:59 SMTP INBOUND: "250-STARTTLS"
        2019-09-18 11:10:59 SMTP INBOUND: "250 HELP"
        2019-09-18 11:10:59 SERVER -> CLIENT: 250-refine.guzelhosting.com Hello localhost [85.103.6.117]250-SIZE 52428800250-8BITMIME250-PIPELINING250-AUTH PLAIN LOGIN250-STARTTLS250 HELP
        2019-09-18 11:10:59 CLIENT -> SERVER: STARTTLS
        2019-09-18 11:10:59 SMTP INBOUND: "220 TLS go ahead"
        2019-09-18 11:10:59 SERVER -> CLIENT: 220 TLS go ahead
        2019-09-18 11:10:59 CLIENT -> SERVER: EHLO localhost
        2019-09-18 11:10:59 SMTP INBOUND: "250-refine.guzelhosting.com Hello localhost [85.103.6.117]"
        2019-09-18 11:10:59 SMTP INBOUND: "250-SIZE 52428800"
        2019-09-18 11:10:59 SMTP INBOUND: "250-8BITMIME"
        2019-09-18 11:10:59 SMTP INBOUND: "250-PIPELINING"
        2019-09-18 11:10:59 SMTP INBOUND: "250-AUTH PLAIN LOGIN"
        2019-09-18 11:10:59 SMTP INBOUND: "250 HELP"
        2019-09-18 11:10:59 SERVER -> CLIENT: 250-refine.guzelhosting.com Hello localhost [85.103.6.117]250-SIZE 52428800250-8BITMIME250-PIPELINING250-AUTH PLAIN LOGIN250 HELP
        2019-09-18 11:10:59 Auth method requested: UNSPECIFIED
        2019-09-18 11:10:59 Auth methods available on the server: PLAIN,LOGIN
        2019-09-18 11:10:59 Requested auth method not available:
        2019-09-18 11:10:59 Auth method selected: LOGIN
        2019-09-18 11:10:59 CLIENT -> SERVER: AUTH LOGIN
        2019-09-18 11:10:59 SMTP INBOUND: "334 VXNlcm5hbWU6"
        2019-09-18 11:10:59 SERVER -> CLIENT: 334 VXNlcm5hbWU6
        2019-09-18 11:10:59 CLIENT -> SERVER: bm9yZXBseUBsaWZlbG9vcGVycy5jb20=
        2019-09-18 11:10:59 SMTP INBOUND: "334 UGFzc3dvcmQ6"
        2019-09-18 11:10:59 SERVER -> CLIENT: 334 UGFzc3dvcmQ6
        2019-09-18 11:10:59 CLIENT -> SERVER: QG5vcmVwbHkxN0A2MQ==
        2019-09-18 11:11:01 SMTP INBOUND: "535 Incorrect authentication data"
        2019-09-18 11:11:01 SERVER -> CLIENT: 535 Incorrect authentication data
        2019-09-18 11:11:01 SMTP ERROR: Password command failed: 535 Incorrect authentication data
        SMTP Error: Could not authenticate.
        2019-09-18 11:11:01 CLIENT -> SERVER: QUIT
        2019-09-18 11:11:01 SMTP INBOUND: "221 refine.guzelhosting.com closing connection"
        2019-09-18 11:11:01 SERVER -> CLIENT: 221 refine.guzelhosting.com closing connection
        2019-09-18 11:11:01 Connection: closed
        SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

我正在尝试使用Function发送邮件,但是它总是抛出错误。我写的功能如下。

public function mailsend($Kullanici_Ad ,  $Kullanici_Mail , $Mail_İcerik , $Mail_Baslık , $Telefon='')
        {
            //SMTP needs accurate times, and the PHP time zone MUST be set
            //This should be done in your php.ini, but this is how to do it if you don't have access to that
            date_default_timezone_set('Europe/Istanbul');
            require ('PHPMailer/src/Exception.php');
            require ('PHPMailer/src/PHPMailer.php');
            require ('PHPMailer/src/SMTP.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
            $mail->SMTPDebug = 4;
            //Set the hostname of the mail server
            $mail->Host = 'mail.lifeloopers.com';
            //Set the SMTP port number - likely to be 25, 465 or 587
            $mail->Port = 587;
            $mail->SMTPOptions = array(
                    'ssl' => array(
                    'verify_peer' => false,
                    'verify_peer_name' => false,
                    'allow_self_signed' => true
                )
            );
            //Whether to use SMTP authentication
            $mail->SMTPAuth = true;

            $mail->CharSet = 'utf-8';
            //Username to use for SMTP authentication
            $mail->Username = 'xxx@lifeloopers.com';
            //Password to use for SMTP authentication
            $mail->Password = 'xxxx';
            //Set who the message is to be sent from
            $mail->setFrom('xxx@lifeloopers.com', 'Noreply');
            //Set an alternative reply-to address
            $mail->addReplyTo($Kullanici_Mail, $Kullanici_Ad);
            //Set who the message is to be sent to
            $mail->addAddress('xxx@lifeloopers.com', 'Norepyl');
            $mail->addAddress('xxx@lifeloopers.com', 'İnfo');
            $mail->addAddress($Kullanici_Mail, $Kullanici_Ad);
            //Set the subject line
            $mail->Subject = $Mail_Baslık;
            //Read an HTML message body from an external file, convert referenced images to embedded,
            //convert HTML into a basic plain-text alternative body
            $mail->msgHTML($Mail_İcerik);
            //Replace the plain text body with one created manually
            $mail->AltBody = $Mail_İcerik;
            //Attach an image file
            //$mail->addAttachment('images/phpmailer_mini.png');
            //send the message, check for errors
            if (!$mail->send()) {
                return 'Mailer Error: ' . $mail->ErrorInfo;
            } else {
                return 'Message sent!';
            }
        }

2 个答案:

答案 0 :(得分:0)

错误说:

Password command failed: 535 Incorrect authentication data
        SMTP Error: Could not authenticate.

因此您的凭据不正确(不再)。

答案 1 :(得分:0)

检查您的凭据并检查参数。 您的邮件服务器使用SMTP还是POP3?