我正在尝试使用Yii2中的。
我的主人是高爸爸,我正在尝试使用gmail帐户发送电子邮件。
代码似乎运行良好,但当我尝试使用它时,我收到了错误:无法与主机smtp.gmail.com连接建立连接,拒绝#111号
我仔细检查了一下我用的是gmail的正确凭证。这是否是我的主机的问题,如果是的话,有办法解决它吗?这是密码
'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
'transport' => [
'class' => 'Swift_SmtpTransport',
'host'=>'smtp.gmail.com',
'username'=>'myUserName@gmail.com',
'password'=>'******',
'port'=>'587',
'encryption'=>'tls',
],
'useFileTransport' => false, //for the testing purpose, you need to enable this
],
I also tried with **`'class' => 'Swift_MailTransport',`**
but the error was not resolved.
The error is 无法在主机smtp.gmail.com连接拒绝#111号时建立连接
请在这方面帮助我。谢谢,
发布于 2020-03-03 07:28:30
似乎您的Swift配置设置无法连接主机Gmail,请尝试下面的更改,很可能会工作:
'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
'useFileTransport' => false,
'transport' => [
'class' => 'Swift_SmtpTransport',
'host'=>'smtp.gmail.com',
'username'=>'myUserName@gmail.com',
'password'=>'******',
'port'=>'465',
'encryption'=>'ssl',
],
],作出的改动:
'port'=>'465',
'encryption'=>'ssl',发布于 2017-11-01 21:31:37
您的配置中似乎有问题,请尝试将配置更改为:
'port'=>'465',
'encryption'=>'ssl'https://stackoverflow.com/questions/47062030
复制相似问题