In our previous article, we installed phpList. Before we continue with creating a mailing list that users can subscribe to, there are some default settings that we must change within the phpList configuration.
By default, phpList will attempt to send out as many emails as fast as possible. To prevent possible issues with spam, accounts on our shared servers have a limit set to the maximum number of emails that can be sent per hour. That limit is set to 250 per domain per hour. What this means is that if you have 700 people in your mailing list and you try to send all of the emails at once with phpList, 250 emails will be sent and the other 450 will fail. To resolve this issue, we need to tell phpList to only send 250 emails per hour.
Please note that we do on a case by case basis increase this number for our users. If you’re interested in being able to send more than 250 emails per hour per domain, please see our Bulk Mailing Request article.
Please also keep in mind that if you normally send 10 emails per hour during your daily routine, then you may need to set phpList to only send 240 emails per hour. In the example below, we will walk you through the steps to configure phpList to send 204 emails per hour at a rate of 17 emails every 5 minutes.
How to edit batch settings in phpList
- Log into your cPanel
- Access your File Manager by clicking the “File Manager” icon.
- Navigate to the directory you installed phplist into. Then navigate to the config directory within that. From there, right click on config.php and click edit. If you’re prompted with a “Text-Editor” window, ensure “utf-8” is selected in the drop down and then click “Edit”
- You are now looking at the phpList configuration file. There is quite a bit of content in this file, your focus is on finding these two lines:
define("MAILQUEUE_BATCH_SIZE",0); define("MAILQUEUE_BATCH_PERIOD",100); Change these values to what we have below: define("MAILQUEUE_BATCH_SIZE",17); define("MAILQUEUE_BATCH_PERIOD",300);
The changes that we made told phpList to send 17 emails every 300 seconds (5 minutes).
- Click “Save Changes”.
Please be aware that you will see the above lines several places in the config file. Please be sure to edit the lines that do not start with a pound sign. There is only one line for each setting that does not begin with #. In the example below, the green lines are where we made the edit, and the red lines are where we DID NOT make any edits due to the line starting with #.
# batch processing
# if you are on a shared host, it will probably be appreciated if you don’t send
# out loads of emails in one go. To do this, you can configure batch processing.
# Please note, the following two values can be overridden by your ISP by using
# a server wide configuration. So if you notice these values to be different
# in reality, that may be the case
## if you send the queue using your browser, you may want to consider settings like this
## which will send 10 messages and then reload the browser to send the next 10. However, this
## will not restrict the sending to any limits, so there’s a good chance you will
## go over the limits of your ISP
# define(“MAILQUEUE_BATCH_SIZE”,10);
# define(“MAILQUEUE_BATCH_PERIOD”,1);
## if you send the queue using commandline, you can set it to something that complies with the
## limits of your ISP, eg 300 messages an hour would be
# define(“MAILQUEUE_BATCH_SIZE”,300);
# define(“MAILQUEUE_BATCH_PERIOD”,3600);
# and then you need to set the cron to run every 5 minutes
# define the amount of emails you want to send per period. If 0, batch processing
# is disabled and messages are sent out as fast as possible
define(“MAILQUEUE_BATCH_SIZE”,17);
# define the length of one batch processing period, in seconds (3600 is an hour)
# Please note: this setting has two consequences:
# 1. it will enforce that the amount of emails sent in the period identified here does not exceed the amount
# set in MAILQUEUE_BATCH_SIZE
# 2. there will be a delay of MAILQUEUE_BATCH_PERIOD when running the queue.
#
# number 1 is mostly when using commandline queue processing (strongly recommended)
# number 2 is when using browser queue processing. The browser will reload to send the next
# batch after the amount of seconds set here
define(“MAILQUEUE_BATCH_PERIOD”,300);
How does rate limiting work in phpList?
Later in our tutorial series, we’ll show you how to send a message to a mailing list in phpList. Because we’re talking about rate limiting right now, we’d like to give you a sneak peak at what it will look like when you send to 400+ users with the above options set.
We initiall sent a message to our list at 9:20 am. The confirmation message below mentions that phpList sent 17 emails, and then will wait 300 seconds (5 minutes) before sending more.
Sending in batches of 17 emails
Processing has started, 1 message(s) to process.
Please leave this window open. You have batch processing enabled, so it will reload several times to send the messages. Reports will be sent by email to [email protected]
Processing message 7
Looking for users
Found them: 403 to process
batch limit reached: 17 (17)
Script stage: 5
17 messages sent in 4.38 seconds (13961 msgs/hr)
Finished this run
Waiting for 300 seconds before reloading
After 5 minutes (it is now 9:25 am), your browser will reload, and you will see another message similar to the below. This message states that in the last run 17 messages were sent, and another 17 messages have been sent now:
Sending in batches of 17 emails
Sent in last run: 17
Skipped in last run: 0
Processing has started, 1 message(s) to process.
Please leave this window open. You have batch processing enabled, so it will reload several times to send the messages. Reports will be sent by email to [email protected]
Processing message 7
Looking for users
Found them: 386 to process
batch limit reached: 17 (17)
Script stage: 5
17 messages sent in 0.51 seconds (119386 msgs/hr)
Finished this run
Waiting for 300 seconds before reloading
At this point, you simply need to leave your browser open. Every 5 minutes, your browser will reload and another 17 emails will be sent.
What happens if my browser closes during sending of my messages?
We had the same question. Right now we’re in the middle of sending 400+ emails at a rate of 17 emails every 5 minutes. We’ve already sent about 51 emails, and we just closed our browser. With the browser closed, phpList will not be able to process the rest of the messages we need sent.
To continue sending your list, simply log back into you phpList admin and click the “process queue” link in the right sidebar:
Helpful, but agree with other commenters… Softalicious should be configured by IT at EVERY shared host (all of which, very reasonably and by necessity. LIMIT outbound emails)… Softalicious’s PHPList install should be TWEAKED so that this configuration file data AUTOMATICALLY conforms to the limits of the specific host’s servers.
Another observation: Ten messages under the limit is not nearly enough. Besides other emails being sent out of the account by the owner, there might very well be automated messages from OTHER software installed on the account (like a CMS or blog), but PHP itself ALSO sends out multiple messages that as far as I know, are NOT queued. Subscribe/unsubscribe messages being one. In-system-forwarding is another (the default templates encourage subscribers to NOT use their email app’s forward button, but rather forward via PHPList to allow the recipient to subscribe or block). If all these GENERATED messages were added to a queue instead, and processed via the CRON job, I’d be a happy camper. Imagine having your list’s subscribe page mentioned on some celebrity’s Twitter or Instagram, only to have your outbound opt-in messages blocked because you went way over your message limit. That would suck.
Thanks for pointing it out, Klaus! I’m going to make sure we run this by one of the teams in charge of such configurations.
Hi boss!! u lok as u undderstand phplist… that great man!! u said that if i send emails with Dedicated server or vps is become unlimeted…!?
Yes, on a VPS or Dedicated server you can change the max emails per hour setting in WHM.
If you are on a shared server, you can request an email limit exception.
Thank you,
John-Paul
So my newly installed phpList has a config.php and a config_extended.php file in the config directory. They both have the BATCH_SIZE and BATCH_PERIOD lines. Do I need to change both files?
According to phpList’s documentation only config.php is modified. I don’t see any mention of the additional config_extended.php file requiring this modification for rate limiting.
How could I imagine that I should limit the sending emails if there is no configuration or advice inside the PHPList / Softaculous software??
My account was suspended and it looks like I lost access to all my work, all my websites and cannot even make a backup of them!
Softaculous should do this! Or, give a notice about it!
The hourly limit for each cPanel account is set within the server itself at the admin level. PHPList and Softaculous have no way of seeing this limit. This can be changed by requesting an exemption within your AMP. If you upgrade to a VPS or Dedicated plan, there is no limit to sending emails.