jeudi 22 juin 2017

Laravel, SwiftMailer and Postfix. Sometimes emails wont send

So recently I saw that SwiftMailer keeps giving me these exceptions on occasion where it can't send an email.

The exception looks like this:

Swift_TransportException: Connection to tcp://my-server.com:587 Timed Out

So I started looking into the Postfix logfiles as I couldn't think of anything else to check. Then I noticed that there's a delay from the postfix/cleanup phase that transitions into the postfix/qmgr phase.

The logfile looks like this:

Jun 20 18:04:11 xxxxxxx postfix/smtpd[12121]: connect from unknown[123.123.123.123]
Jun 20 18:04:11 xxxxxxx postfix/smtpd[12121]: setting up TLS connection from unknown[123.123.123.123]
Jun 20 18:04:11 xxxxxxx postfix/smtpd[12121]: Anonymous TLS connection established from unknown[123.123.123.123]: TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)
Jun 20 18:04:11 xxxxxxx postfix/smtpd[12121]: E3BA7D5608F: client=unknown[123.123.123.123], sasl_method=LOGIN, sasl_username=myusername
Jun 20 18:04:11 xxxxxxx postfix/cleanup[5660]: E3BA7D5608F: message-id=<06d251dd2827101bdae87a2ea145c007@*.xxxx.com>
...
Jun 20 18:04:47 xxxxxxx postfix/qmgr[8096]: E3BA7D5608F: from=<xxxx@customers.xxxx.com>, size=1606, nrcpt=1 (queue active)
Jun 20 18:04:47 xxxxxxx postfix/smtpd[12121]: warning: network_biopair_interop: error writing 37 bytes to the network: Broken pipe
Jun 20 18:04:47 xxxxxxx postfix/smtpd[12121]: disconnect from unknown[123.123.123.123]

So as you can see in the timestamps, the postfix/cleanup entry happens at 18:04:11, while the related postfix/qmgr entry is at 18:04:47, so 36 seconds later. I'm assuming this has to happen instantaneously in order to avoid those failed emails.

So, that is my idea to why that SwiftMailer exception is working since its timeout is 30 seconds and this is taking more than 30 seconds to be handled.

Any ideas on how to fix this would be highly appreciated.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2sX5vXl
via IFTTT

Aucun commentaire:

Enregistrer un commentaire