无法使用yii2 swiftmailer发送邮件

问题描述 投票:1回答:1

尝试使用Yii :: $ app-> mailer-> compose()函数发送邮件时出现错误。尝试连接smtp服务器时出现此错误,因此我提供了错误消息和mailer YII2配置]

Expected response code 250 but got code "535", with message "535-5.7.8 Username and Password not accepted. Learn more at 535 5.7.8 https://support.google.com/mail/?p=BadCredentials 59sm3639427wrc.23 - gsmtp"

这里是config / common.php文件中的参数:

'mailer'       => [
        'class'            => 'yii\swiftmailer\Mailer',
        'useFileTransport' => false,
        'transport'        => [
            'class'      => 'Swift_SmtpTransport',
            'port'       => '587',
            'encryption' => 'tls',
            'username' => '[email protected]',
            'password' => 'myemailpass',
            'host' => 'smtp.mail.yahoo.com',
        ],
    ],

我已经在Yahoo帐户设置中启用了“允许使用较少安全性登录的应用程序”功能。尝试使用“应用程序密码”选项,但结果相同。在使用yahoo smtp之前,我用google smtp尝试了相同的方法。错误消息仍然指向https://support.google.com页面。 Apache缓存的登录名是否可以传递到smtp服务器?

当然,我检查了Google支持页面,并遵循了https://accounts.google.com/DisplayUnlockCaptcha页面中的说明。

php yii2 smtp swiftmailer mailer
1个回答
0
投票
尝试更改端口

'mailer' => [ 'class' => 'yii\swiftmailer\Mailer', 'useFileTransport' => false, 'transport' => [ 'class' => 'Swift_SmtpTransport', 'port' => '465', 'encryption' => 'tls', 'username' => '[email protected]', 'password' => 'myemailpass', 'host' => 'smtp.mail.yahoo.com', ], ],

© www.soinside.com 2019 - 2024. All rights reserved.