PHP: sending a huge number of letters in batch mode

Having cast aside contempt for unwanted advertising, I need to send about 15,000 letters to clients. My colleague tried to send them via php mail loop, but obviously he was quickly stuck. Is there a normal (i.e. via PHP script) to execute this fast? If not, how do you suggest me to do this (possibly through exec ) without unnecessary overhead?

Thanks!

+6
php email batch-file
source share
4 answers

I used PEAR Mail_Queue to post 200,000 + mails at a time. Filling the database is quick and easy, even with customized content, and then a fairly simple script sends about 250 times - if the average load is not too large. Then he moves and sends the next batch.

You will not send them faster than usual, but it will do without problems.

The tutorial gives you almost everything you need - just go around the "send_messages.php" script (better from the command line) until the database queue is empty.

+4
source share

You can look at something like Gearman to create a queue system, as recommended here . Another option is to look at a paid service like Amazon Simple Email Service (SES)

+2
source share

No matter how you implement immediate delivery: it will be a lengthy process that will always be interrupted, and you cannot afford to restart delivery and send the same message twice to 5000 clients.

I believe a reliable system should use queues. The main script simply adds the recipients to the queue, and then you have a secondary process that selects the elements from the queue, sends them, and finally marks them as sent. This secondary process can be started manually (possibly from the command line) or through the cron tab.

I never used, but I have it in my bookmarks: http://ledscripts.com/free/php/phpledmailer

+1
source share

Do you execute it via CGI or as a script on the command line? It is best to run it as a script on the command line.

If you say it is stuck try running set_time_limit(0); to avoid PHP exiting from running too long.

0
source share

All Articles