Rate limit the sending of messages in phpListWritten by Jacob Nicholson
In this article we'll discuss how you can rate limit how quickly phpList will attempt to send out your messages.
This is important because by default phpList will attempt to send mail out as quickly as it can all at once. On our shared servers there is a default outbound mailing limit of 250 messages per hour, so if you had a list of 500 users, the first 250 would deliver without issue, but the second 250 would not.
If you do have very large lists setup in phpList, you do have the option to fill out our bulk mailing information request form to increase your hourly limit for outgoing mail. However it's always still desirable to rate limit your sending of messages so that you're not causing an excessive amount of usage on the server from it having to handle so many deliveries at once.
Enable rate limiting in phpList
- Login to your cPanel
- Under the Files section, click on File Manager.
- Select the Document Root for option, then select the domain you have phpList installed on from the drop-down, then click Go
- From the left hand pane, expand your public_html directory, as well as the list one, then click on the config directory.
- Right click on your config.php file, then click on Code Edit from the drop-down.
If there is an encoding check pop-up that displays, simply click on Edit.
- Now we will setup phpList so that it sends its messages rate limited, instead of all at once. You need to modify the MAILQUEUE_THROTTLE setting in order to accomplish this.
MAILQUEUE_THROTTLE = Time to wait (in seconds) between your messages.
We need to do a little math to determine what the best value would be for your mailings. In this example, let's assume that you haven't requested an increase in your mailing limit so it's still 250 messages / hour, and you on average send out about 10 emails an hour outside of phpList.
3600 = Seconds in an hour
250 = Email limit per hour
10 = Emails sent outside of phpList
240 = Emails an hour phpList can send
3600 / 240 = 15 (1 message every 15 seconds)
- You can use Ctrl-F in your web browser to bring up the find function of the code editor to easily locate the section of code you need to edit.
Just type in MAILQUEUE_THROTTLE in the search field and then click on find next.
The line you need to look for should fall around Line: 350 and looks like:define('MAILQUEUE_THROTTLE',0);
Change this to:define('MAILQUEUE_THROTTLE',15);
After making this edit, click on Save Changes at the top right to make this setting active.
Now if you send a message to one of your lists in phpList, it should be rate limited so that you don't go over your hourly outgoing mail limit.
- If you've clicked on send a message from the right hand menu, and already filled out your message on the Content tab. I'd recommend also clicking on the Misc tab and filling out the email alerts information prior to sending your message. This way you'll get an alert when the message starts sending, and when it's completed.
In our example we're going to use the same listreports@PrimaryDomain.com email address that we already created earlier in our article on how to configure general system values in phpList.
email to alert when sending of this message starts listreports@PrimaryDomain.com email to alert when sending of this message has listreports@PrimaryDomain.com
After filling out the addresses you'd like to be alerted at, click on Save Changes.
- Now click on the Lists tab, select the mailing list you want to send your message to, and then click on Send Message to the Selected Mailinglists.
- Finally click on process the message queue to actually begin sending your message.
Please note that once the sending of your message begins, you can't stop it. If your web browser window times out, you wont be able to access phpList again until the sending completes.
At this point if you needed to modify anything with your message prior to sending it, you can click on messages from the right hand menu, click on the queued tab, and then click on suspend sending if you needed another message to be processed first. Or you can click on edit to edit the contents of the message that you have queued for delivery before actually sending it out.
If you did either of these, you can then click on process queue from the main right hand menu to go ahead and start sending the message.
- You should see the message you queued begin to be sent. At this point you can go ahead and close your web browser.
If you don't see the message process window, the message is still getting sent out. Check your email address that you setup to be alerted when the sending of a message starts, and you should see that it did in fact begin to send.
- After you've received your email alert that the mailing has completed, you can log back into the phpList admin, then click on messages from the right hand menu.
You should see the count of how many messages were sent out, and the time it took to send them.
You should now know how to rate limit your mailings with phpList so that you can stay within your mailing limits and enjoy a flawless mailing experience!
Sending messages with phpList
|1.||Sending a test message in phpList|
|2.||Rate limit the sending of messages in phpList|
|3.||Send a message to a list in phpList|
|4.||Handling bounces with phpList|