无法与主机建立 SwiftMailer 连接 [英] SwiftMailer Connection could not be established with host
问题描述
从我的网站发送电子邮件时出现意外问题.它已经运行了一段时间,但突然似乎无缘无故停止了.
I am getting an unexpected problem with emails being sent from my site. It had been working fine for some time and all of a sudden seems to have stopped for no apparent reason.
[Swift_TransportException] 在 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php:265 中出现消息无法与主机建立连接 [连接超时 #110]"的异常Swift_TransportException"
[Swift_TransportException] exception 'Swift_TransportException' with message 'Connection could not be established with host [Connection timed out #110]' in vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php:265
在我的 web.php 中
In my web.php
'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
'transport' => [
'class' => 'Swift_SmtpTransport',
'host' => 'mail.website.com',
'username' => 'username',
'password' => 'password',
'port' => '587',
'encryption' => 'tls',
],
可能会发生什么导致它停止工作,我应该如何修复它?
What could have happened for this to stop working and how should I be fixing it?
我的电子邮件使用谷歌应用程序,但我一直使用此配置连接到我的邮件服务器.我不知道为什么它突然停止工作.
I am using google apps for my emails, but I have always used this config where I connect to my mail server. I'm not sure why it suddenly stopped working.
推荐答案
几天前我在 yii 中也发生了同样的事情.通过更改端口解决了.
Same thing thing happened to me in yii , couple of days ago.Solved it by changing the port.
试试,
'port' => 26,
这篇关于无法与主机建立 SwiftMailer 连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!