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] 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
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.
it's looking for the server mail.website.com but isn't able to resolve it. use this domain
smtp.gmail.com
and port25 or 465
.So you either need to input a valid smtp server or wrap the send() line in a try/catch to catch the exception and either log it somewhere or ignore it. Please checkif the port you use is really the port used by your mail server.
Same thing thing happened to me in yii , couple of days ago.Solved it by changing the port.
Try,