Swift_TransportException无法使用2个可能的身份验证器在用户名为“ example@gmail.com”的SMTP服务器上进行身份验证

时间:2019-02-08 10:36:06

标签: yii2 smtp

我正在使用yii2邮件功能,并且遇到错误如下的问题

 Swift_TransportException
    Failed to authenticate on SMTP server with username "example@gmail.com" using 2 possible authenticators. Authenticator LOGIN returned Swift_TransportException: Expected response code 235 but got code "535", with message "535 Incorrect authentication data

这是我对邮件程序的配置

'mailer' => [
            'class' => 'yii\swiftmailer\Mailer',
            'viewPath' => '@common/mail',

            'transport' => [
                'class' => 'Swift_SmtpTransport',
                'host' => 'smtp.gmail.com',  // e.g. smtp.mandrillapp.com or smtp.gmail.com
                'username' => 'example@gmail.com', //ses-smtp-user.20180221-103827  username: administrator
                'password' => "example123#",
                'port' => '587', // Port 25 is a very common port too 25, 465 or 587
                'encryption' => 'tls', // It is often used, check your provider or mail server specs
                'streamOptions' => [
                    'ssl' => [
                        'verify_peer' => false,
                        'verify_peer_name' => false,

                    ]
                ],
            ],
            // send all mails to a file by default. You have to set
            // 'useFileTransport' to false and configure a transport
            // for the mailer to send real emails.
            'useFileTransport' => false,
        ],

如果有人知道问题出在哪里,请让我知道我没有弄错哪里了,谢谢!

0 个答案:

没有答案