Understanding the Cron
The MailPoet newsletter delivery system relies heavily on the Cron, and as a result, most potential problems are associated with it. In this Knowledge Base article, we'll explain what the Cron is.
According to this Wikipedia article:
The software utility Cron is a time-based job scheduler in Unix-like computer operating systems. People who set up and maintain software environments use cron to schedule jobs (commands or shell scripts) to run periodically at fixed times, dates, or intervals. It typically automates system maintenance or administration—though its general-purpose nature makes it useful for things like connecting to the Internet and downloading email at regular intervals. The name cron comes from the Greek word for time, χρόνοςchronos.
However, when we talk about the "Cron" in the context of MailPoet, we are talking about the WP-Cron, the WordPress variant. According to Ben Lobaugh in this awesome article:
Cron is the time-based task scheduling system that is available on UNIX systems. WP-Cron is how WordPress handles scheduling time-based tasks in WordPress. Several WordPress core features, such as checking for updates and publishing scheduled post, utilize WP-Cron, though WP-Cron is still an largely under-documented and under-utilized feature in WordPress.
WP-Cron works by checking on every page load through a list of scheduled tasks to see if there are any tasks that need to be run. If there are any tasks scheduled at the time of page load they will be run. It must be noted here that WP-Cron does not run constantly as the system cron does. WP-Cron will only be triggered on page load, this means if you have a task scheduled for 2:00 PM but do not have any visitors until 5:00 PM your task will not run until then.
How does MailPoet use the WP-Cron?
MailPoet splits the total amount of recipients of your newsletter to be sent in smaller batches. For this task, it relies on the WP-Cron to schedule these batches to be sent according to your sending frequency.
For example: let's say that your " Latest Posts" newsletter contains 1,200 recipients (total subscribers among your specified lists) and your sending frequency is 50 emails per 5 minutes. This means that 600 emails will be sent in one hour (5 minutes x 12 = 60 minutes, so 12 x 50 emails = 600 emails per hour). This means that your "Latest Posts" newsletter will take a total of 2 hours to send the 1,200 emails/newsletters to all its recipients.
In this case, MailPoet uses the WP-Cron to schedule your newsletter to be sent in 24 batches of 50 emails each.
Why can't you send all of your newsletters in one batch? Read the third item of this article: Choosing a Sending Frequency: How Does It Work?
How does the WP-Cron work on WordPress?
WP-Cron is not a real Cron, because it is not a computer program that runs as a background process, like the real Cron does on UNIX systems. Instead, the WP-Cron is activated (or triggered) on each visit to your website.
Each time a page on your website gets visited, WordPress calls the WP-Cron function, which will look for scheduled jobs that should run. If one is found, WP-Cron sends an HTTP request to yourdomain.com/wp-cron.php to execute the tasks scheduled. In MailPoet's case, this task is to send your next batch of newsletters.
What happens if your sending frequency is set up to send a batch of newsletters each 5 minutes, but your site is not visited during this time interval? Your newsletters won't be sent! Thus delaying the delivery of your newsletter.
MailPoet Premium users get their website visited from our servers every 5 minutes. Free users, on the other hand, will have to rely on their own website traffic (and visitors) to send their newsletters on time.
We recommend that you set up your own Cron job on your server if:
- You want to increase your sending frequency and send more batches of emails in less time, for example, 50 emails per minute.
- You are a Free user and want to make sure your newsletters get delivered on time.