Hi!
First of all I'd like to thank you for developing this great tool.
I am in charge of sending the daily newsletters for about 10 websites. Until now the sending was done with a loop on the classic mail() function. A complete loop took about 1 hour for a 110.000 emails list to be transfered to the server for sending. From this point the mail server takes care of sending and retrying the deferred emails.
After rebuilding the newsleter script using SwiftMailer, the whole process took about 3 hours instead of 1, with SMTP connection instead of mail(). Why is that? Shouldn't it work faster by SMTP? It is important for us that the emails get transfered to the server as fast as possible.
How can i optimize the sending process further?
Thanks,
Andrew.
Sending 130.000 emails daily
Moderators: Chris Corbyn, General Moderators
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: Sending 130.000 emails daily
SMTP is slower. mail() just throws messages onto the spool and the messages just sit on the spool until the server can get rid of them.andrys wrote:Hi!
First of all I'd like to thank you for developing this great tool.
I am in charge of sending the daily newsletters for about 10 websites. Until now the sending was done with a loop on the classic mail() function. A complete loop took about 1 hour for a 110.000 emails list to be transfered to the server for sending. From this point the mail server takes care of sending and retrying the deferred emails.
After rebuilding the newsleter script using SwiftMailer, the whole process took about 3 hours instead of 1, with SMTP connection instead of mail(). Why is that? Shouldn't it work faster by SMTP? It is important for us that the emails get transfered to the server as fast as possible.
How can i optimize the sending process further?
Thanks,
Andrew.
EDIT | I'd love to see what sort of load average you were getting doing that
The server is a Quad-Core and the system load peak is at ~43%.
So basically when sending directly through a SMTP server, the script waits for a response for each email?
Yesterday I tried sending a newsletter with batchSend and I got this:
So basically when sending directly through a SMTP server, the script waits for a response for each email?
Yesterday I tried sending a newsletter with batchSend and I got this:
What's the correct approach? Catching the exception and disconnecting and reconnecting to the SMTP server?PHP Fatal error: Uncaught exception 'Swift_BadResponseException' with message 'Expected response code(s) [250] but got response [421 4.4.2 http://www.domain.com Error: timeout exceeded]' in /etc/newsletter/swift/Swift.php:253
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Yes. SMTP has the benefit of receiving feedback from the server, but at a cost of time to have a conversation + of course, it has to send everything over TCP. TCP is where it slows down more than anything. If you think your emails are being sent faster with mail(), they're not. They're just being written to the disk on the server quickly. Swift does come with various connectivity options (including mail()).andrys wrote:The server is a Quad-Core and the system load peak is at ~43%.
So basically when sending directly through a SMTP server, the script waits for a response for each email?
Upgrade to 3.2.0. It won't "stop" such errors, but batchSend() recovers from them (or tries to).Yesterday I tried sending a newsletter with batchSend and I got this:
What's the correct approach? Catching the exception and disconnecting and reconnecting to the SMTP server?PHP Fatal error: Uncaught exception 'Swift_BadResponseException' with message 'Expected response code(s) [250] but got response [421 4.4.2 http://www.domain.com Error: timeout exceeded]' in /etc/newsletter/swift/Swift.php:253
That's a network issue from looking at the error message.