G Suite SMTP邮件未发送

时间:2019-04-11 05:20:39

标签: php email smtp phpmailer gsuite

我正在使用PHPMailer通过SMTP发送邮件,它可以与我的个人帐户完美配合,但是当我使用gsuite gmail帐户时,会给我错误。

    2019-04-11 05:21:54 SERVER -&gt; CLIENT: 220 smtp-relay.gmail.com ESMTP 11sm586472itw.3 - gsmtp<br>
2019-04-11 05:21:54 CLIENT -&gt; SERVER: EHLO 172.16.17.54<br>
2019-04-11 05:21:54 SERVER -&gt; CLIENT: 250-smtp-relay.gmail.com at your service, [202.131.125.99]250-SIZE 157286400250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8<br>
2019-04-11 05:21:54 CLIENT -&gt; SERVER: AUTH LOGIN<br>
2019-04-11 05:21:55 SERVER -&gt; CLIENT: 334 VXNlcm5hbWU6<br>
2019-04-11 05:21:55 CLIENT -&gt; SERVER: &lt;credentials hidden&gt;<br>
2019-04-11 05:21:55 SERVER -&gt; CLIENT: 334 UGFzc3dvcmQ6<br>
2019-04-11 05:21:55 CLIENT -&gt; SERVER: &lt;credentials hidden&gt;<br>
2019-04-11 05:21:55 SERVER -&gt; CLIENT: 535-5.7.8 Username and Password not accepted. Learn more at535 5.7.8  https://support.google.com/mail/?p=BadCredentials 11sm586472itw.3 - gsmtp<br>
2019-04-11 05:21:55 SMTP ERROR: Password command failed: 535-5.7.8 Username and Password not accepted. Learn more at535 5.7.8  https://support.google.com/mail/?p=BadCredentials 11sm586472itw.3 - gsmtp<br>
SMTP Error: Could not authenticate.<br>
2019-04-11 05:21:55 CLIENT -&gt; SERVER: QUIT<br>
2019-04-11 05:21:56 SERVER -&gt; CLIENT: 221 2.0.0 closing connection 11sm586472itw.3 - gsmtp<br>
SMTP Error: Could not authenticate.<br>

这是SMTP设置

            $mail->SMTPDebug = 2;                                 // Enable verbose debug output
            $mail->isSMTP();                                      // Set mailer to use SMTP
            $mail->addCustomHeader('MIME-Version: 1.0');
            $mail->addCustomHeader('Content-Type: text/html; charset=utf-8');
            $mail->Host = 'smtp-relay.gmail.com';  // Specify main and backup SMTP servers
            $mail->SMTPAuth = true;                               // Enable SMTP authentication
            $mail->Username = '****@domain.com';                 // SMTP username
            $mail->Password = '****';                           // SMTP password
            $mail->SMTPSecure = 'ssl';                            // Enable TLS encryption, `ssl` also accepted
            $mail->Port = 465;                                    // TCP port to connect to

0 个答案:

没有答案
相关问题