Websites and applications

Set up phpList to send emails and newsletters

Reviewed on 7 min read SMTP deliverability

phpList is a tool for sending newsletters and emails to subscriber lists. You can install it in a couple of clicks from Softaculous.

It works straight after installation, but with the default settings it sends with PHP's mail() function and all at once. As a result, emails end up in spam, other servers reject them or our systems block them when they see an abnormal volume. These three settings prevent that.

They are all made in phpList's config/config.php file (inside the installation folder, usually lists/config/config.php). Edit it from the cPanel File Manager. If a line starts with //, it is disabled: remove those characters to enable it. If your config.php is missing any of the lines, add it at the end.

1. Send over authenticated SMTP

Sending with the username and password of an email account, instead of with the PHP mail function, is the first step towards giving your emails credibility.

Find these lines:

// To use a SMTP server please give your server hostname here, leave it blank to use the standard
// PHP mail() command.
define('PHPMAILERHOST', '');

// if you want to use smtp authentication when sending the email uncomment the following
// two lines and set the username and password to be the correct ones
//$phpmailer_smtpuser = 'smtpuser';
//$phpmailer_smtppassword = 'smtppassword';

And change them to this:

define('PHPMAILERHOST', 'localhost');
$phpmailer_smtpuser = 'boletines@tudominio.com';
$phpmailer_smtppassword = 'contraseña-del-buzon';
  • PHPMAILERHOST: the mail server. As phpList is on the same hosting, enter localhost.
  • $phpmailer_smtpuser: an email account on the domain, created beforehand in cPanel > Email Accounts.
  • $phpmailer_smtppassword: that account's password.

If you send through an external provider, enter its server in PHPMAILERHOST and add its port and encryption with define('PHPMAILERPORT', 587); and define('PHPMAILER_SECURE', 'tls');.

2. Check SPF and DKIM

These DNS records let the receiving server check that yours is authorised to send on behalf of the domain. Our systems set them up by default, but check that they are active, especially if the domain's DNS is outside Hostsuar.

3. Split sending into batches

For security, our servers limit the number of emails each domain can send per hour. The default limit is 700 emails per hour, enough for normal use (we can raise it for regular use, but not for bulk sending). If phpList sends more than that at once, the ones over the limit fail.

That is why you need to set phpList to spread the campaign over hourly batches until it is complete. Sending gradually also improves your sending reputation.

Find these lines:

// 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', 0);

// define the length of one batch processing period, in seconds (3600 is an hour)
define('MAILQUEUE_BATCH_PERIOD', 3600);

// to avoid overloading the server that sends your email, you can add a little delay
// between messages that will spread the load of sending
define('MAILQUEUE_THROTTLE', 0);

And change them to this:

define('MAILQUEUE_BATCH_SIZE', 500);
define('MAILQUEUE_BATCH_PERIOD', 3600);
define('MAILQUEUE_THROTTLE', 0.2);
  • MAILQUEUE_BATCH_SIZE: emails per batch. With 500 you leave room for the domain's normal email and for other applications (website forms, the shop…), which count towards the same limit.
  • MAILQUEUE_BATCH_PERIOD: length of each period in seconds. With 3600, one batch is sent per hour.
  • MAILQUEUE_THROTTLE: pause in seconds between one email and the next. With 0.2, sending is less intensive.

You can adjust these values, as long as the batch plus the rest of the domain's email does not exceed the hourly limit.

Process the queue automatically

phpList only sends while something is processing the queue. If you do it from the phpList panel, you will have to leave the page open for hours. It is better to create a scheduled task in cPanel > Cron Jobs that processes it every few minutes, for example every 15:

*/15 * * * * php /home/USUARIO/public_html/lists/admin/index.php -p processqueue -c /home/USUARIO/public_html/lists/config/config.php > /dev/null 2>&1

Replace USUARIO with your cPanel username and adjust the path if phpList is not in public_html/lists. To run from cron, config.php must have this line enabled (it comes like this in phpList's reference configuration):

$commandline_users = array();

You will find more details on scheduled tasks in how to set up cron jobs.

Keep your contact list clean

Lists of any size always have addresses that bounce: full mailboxes, domains or users that no longer exist. If bounces keep happening, they lower the reputation of the rest of your emails, and in large numbers our security systems may block sending as suspicious.

When you get a bounce, look at the error. If the address does not exist, remove it from the list. A full mailbox is temporary and waiting may be enough. Also make sure the unsubscribe link works.

For large volumes, a specialist service

Our email is designed for business use, with a steady flow. Bulk sending is something else: large amounts of email in a short time, which need several servers and IPs to spread the load without losing reputation. There are specialist services for that, which you can use with any hosting, for example:

Many of them let you keep using phpList and send through their SMTP: just enter their details in step 1.

More information in problems and solutions for bulk email sending.

You may also find useful

Something wrong or out of date? Tell us and we will review it.