The Delivery Engine Speed

Use the  forum to discuss or ask for help, thank you!

The delivery engine is a core part of Newsletter that takes care to send your newsletters. This engine works well if two conditions are satisfied:

  1. your blog is able to send emails reliably
  2. your WordPress cron system is working correctly

Both these topics are covered below.

The Delivery Engine Speed

The delivery engine speed (measured in emails per hour) can be configured on Newsletter configuration panel. Since the delivery engine runs every five minutes if you set 100 emails per hour about 8 emails are sent on each run. Sometime you can experience a speed lower than what you set. The reason is not obvious and it’s about the PHP execution timeout. PHP is configured to run an operation for a max of X seconds. If the script takes longer it’s stopped.

Sending emails can be a slow process, specially if the mail service is slow. So Newsletter must check if the process is reaching the PHP execution timeout and stop it self to avoid problems. You can see if that is happening, enabling on diagnostic panel the main log at info level and look at the log files for a “time limit reached” line.

On shared hosting PHP time limit cannot be raised (usually), on dedicated or virtual server it can be raised. For who think the PHP time limit can be changed with a set_time_limit call, remember that PHP (most of the time) is ran as fastcgi process and the fastcgi controller will kill it if it take too longer to end. May be other tech tricks can be used… but for safety the plugin only keeps an eye on this timeout and tries to avoid to pass it.

Is your blog ready to send email?

A blog can send emails in a reliable fashion if the provider has configured a good email system for his customers. Some hosting provider, specially with shared web spaces, have a inefficient mail service which permits only tens of mails per day (it means it will take tens of days to send to a 1000 subscriber list).

Other provider totally disable the mail system in their server.

Big player, anyway, like Hostgator, Dream Host and so on, let you to send a reasonable number of emails from your blog, state that you are able to “throttle” them. It means you must respect the provider limit, for example not more than 100 emails per hour.

GoDaddy, to cite one of the most used providers, has a strict limit of 250 emails per day (not per hour) if things has not changed and it requires the use of an SMTP.

The use of an external SMTP can be a good choice. For example I use SendGrid.

The cron system is working?

A cron system is something that works even if not one is looking at the blog. A cron system can wake up the blog and their plugin regularly, so they can take some actions (like send emails).

WordPress cannot have a real cron system because PHP cannot. The WordPress team, anyway, find a way to emulate a cron system because the need to trigger future or regular event to make the blog work correctly. For example to publish a scheduled post.

Newsletter Delivery Engine relies on WordPress cron system, so we must be sure it is working. When this system does not work as wanted?

  1. On very low traffic sites
  2. On sites with cache systems
  3. On sites with the cron disabled (one  click installed blog on Aruba.it for example)
  4. On sites “blocked” with basic authentication, ip filtering, cookie filtering or other filters which blocks the call to wp-cron.php

Without explain the technical reason of that, let me to indicate the solutions.

First you need to be sure the cron is not disabled (see exceptions below) with a

define('DISABLE_WP_CRON', true);

inside the wp-config.php file. If there is such line of code, delete it. Then be sure you are not blocking the wp-cron.php calls with basic authentication or something like. If you see to keep the blog protected, at least unlock the wp-cron.php call.

To test the wp-cron.php call, try to load it directly from your browser with something like:

http://www.yourdomain.com/wp-cron.php

Second you should be sure the cron is triggered on a regular base and this is very easy to do just setting up a call to wp-cron.php. There are many ways to do that, let me show a couple of examples.

If and only if you setup a regular external call to wp-cron.php, you can even use the

define('DISABLE_WP_CRON', true);

that can improve the blog server overall loading and avoid overlapping job executions.

Check with a cron manager

You can see the internal scheduler status of your blog using, for example, Advanced Cron Manager. This really useful plugin adds and entry in the Tools menu of WP. It lists the active schedules with some information about their next execution. If the Newsletter schedule is correctly setup you should find something like:

If the newsletter schedule is not present, try to deactivate and reactivate the plugin.

Using  your provider control panel

Most provider have in their control panels the ability to setup a cron job. A cron job is something that will be execute periodically. What we need is an HTTP call to the file wp-cron.php of your WordPress installation. It can be make with:

wget --delete-after http://www.yourdomain.com/wp-cron.php

if the blog is installed in a sub folder, the call must be changed to something like:

wget --delete-after http://www.yourdomain.com/subfolder/wp-cron.php

You can try that address (http://www.yourdomain.com/wp-cron.php) to see if a blank page is returned (it’s ok) or if there is some error report (the address is not correct).

To make Newsletter work smoothly, this call should be done every 5 minutes. For example see the Hostgator cpanel screen shot below (copy the values exactly as in the picture).

Note: from the end of 2013 it seems Hostgator does not enable anymore this kind of setup. Only interval of 15 minutes or more are allowed. See below for other services.

Using a online cron service

If you provider cannot be of help in setting up a cron job, you can try to use a free service (usually they have even a counter professional part).

Here a possible list:

  • www.easycron.com (see this post – they have specific instructions for Newsletter plugin)
  • www.onlinecronjobs.com
  • cronless.com
  • www.cronjobs.org
  • www.mywebcron.com