Sunday, August 17, 2008

Mail Batch Settings for PHPList

If you use the free PHPList for mailing to a large mailing list, you may want to know how to handle batch sizes so you don't overload the mail server.

My host and mail server is Lunarpages, whom I highly recommend for the incredible service they provide and the extremely low price for web hosting ($6.95/month!).

When my mailing list got to over 800 names, I started getting errors when I sent mail, and it looked like it was some kind of "over limit error."

I didn't understand, so I called Lunarpages' tech help, and they explained to me that a limit is placed on the mailing account, and that it's 800 e-mails per hour. This is so the server does not get over-taxed.

Nevermind that... since I wrote the above they have reduced it to 400 "but we recommend you treat it as 300." They have also limited the per minute bulk sends to 20. So the remainder of this discussion has been altered to accommodate the new limits as of January 2010.

PHPList can send the whole batch -- currently around 1500 subscribers -- in a minute or two, but Lunarpages was stopping the batch send-out at 400 -- meaning 1100+ subscribers would not get my mailings. PHPlist has no way of knowing Lunarpages tosses them out, so it assumes they have all been sent and received.

So I got into the code and changed some settings. Here's what to do:

Go to the file Admin > Configure > config.php and find the line that starts with
define("MAILQUEUE_BATCH_SIZE"... etc.


Change that setting and the next two to match this:

define("MAILQUEUE_BATCH_SIZE",20);

define("MAILQUEUE_BATCH_PERIOD",122);

define('MAILQUEUE_THROTTLE',4);


This makes PHP load the entire list of subscribers and send them out in timed batches. The default batch period is 3600 [seconds] -- which is one hour. But the changes above send out a batch of 20 immediately, and then new batches of 20 e-mails, every time 122 seconds. But then there's the throttle...

The throttle is in seconds, too. I put a 4 in there, so it waits 4 seconds between each individual message, taking at least 100 seconds to send, but actually a bit more. This is a courtesy to the mail server, since some servers object to having to process a 'dump' of emails immediately. No one at Lunarpages was objecting, though, and each batch is completed within 2 minutes.

1 comment:

Tim R said...

Lunarpages is great, and so is PhpList. An alternative to sending blobs of 700 emails at once is to use phplist's "throttle" feature, which lets you trickle out messages over a specified time period by inserting a lag of few seconds between each send. This can also help if some recipient domains balk at getting too much mail at once.