XF 2.2 Amazon SES emails randomly fail


Active member
Around 6 months ago we moved to a better VPS, around this time we started getting constant failures of emails being passed through amazon.

Is there a work around for this?

It's setup to use SMTP via Port 587 (which is open) and TLS for encryption.

The errors always as below, and doesn't always happen.
Swift_TransportException: Email to ~removed~ failed: Connection could not be established with host email-smtp.eu-west-1.amazonaws.com :stream_socket_client(): php_network_getaddresses: getaddrinfo failed: Name or service not known src/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php:261

Generated by: Unknown account May 16, 2021 at 7:50 PM

Stack trace​

#0 [internal function]: Swift_Transport_StreamBuffer->{closure}(2, 'stream_socket_c...', '/home/remove...', 264, Array)
#1 src/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php(264): stream_socket_client('tcp://email-smt...', 0, 'php_network_get...', 30, 4, Resource id #11)
#2 src/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php(58): Swift_Transport_StreamBuffer->establishSocketConnection()
#3 src/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(143): Swift_Transport_StreamBuffer->initialize(Array)
#4 src/XF/Mail/Mailer.php(286): Swift_Transport_AbstractSmtpTransport->start()
#5 src/XF/Mail/Queue.php(138): XF\Mail\Mailer->send(Object(Swift_Message), Object(XF\Mail\SmtpTransport), Array)
#6 src/XF/Job/MailQueue.php(12): XF\Mail\Queue->run(8)
#7 src/XF/Job/Manager.php(258): XF\Job\MailQueue->run(8)
#8 src/XF/Job/Manager.php(200): XF\Job\Manager->runJobInternal(Array, 8)
#9 src/XF/Job/Manager.php(84): XF\Job\Manager->runJobEntry(Array, 8)
#10 job.php(43): XF\Job\Manager->runQueue(false, 8)
#11 {main}

Using telnet via ssh to check, we can open connections fine.
That's essentially reporting that the DNS lookup failed. Ultimately, this is at a low level as it would be part of the OS networking settings. There isn't really anything I could specifically point you to regarding that; it could be an issue connecting to the DNS server at the time, for example.

Note that we re-enqueue mail that can't be sent, so it should be retried later (and very likely sent successfully).
  • Like
Reactions: W.D
Top Bottom