gpt4 book ai didi

php - Yii swiftmailer 无法在实时服务器上工作

转载 作者:搜寻专家 更新时间:2023-10-31 21:24:07 24 4
gpt4 key购买 nike

我正在使用 yii2 并且我已经设置了一个邮件程序如下

  <?php
return [
'components' => [
....
'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
'viewPath' => '@common/mail',
// 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,
'transport' => [
'class' => 'Swift_SmtpTransport',
'host' => 'smtp.gmail.com',
'username' => 'myemail@gmail.com',
'password' => 'mygmailpassword',
'port' => '465',
'encryption' => 'ssl',
],
],
],

];

以上在本地主机上完美运行,但当我上传到实时服务器时失败,我总是收到错误凭证错误

错误是

Swift_TransportException

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
r199sm3707144wme.1 - gsmtp

可能是哪里出了问题,

最佳答案

我将此配置用于 gmail(和工作)

        'transport' => [
'class' => 'Swift_SmtpTransport',
'host' => 'smtp.gmail.com',
'username' => 'myname.mylast@gmail.com',
'password' => 'mypass',
'port' => '587',
'encryption' => 'tls',
],

关于php - Yii swiftmailer 无法在实时服务器上工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40058955/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com