Guide to configure a Cron job on your server
If you want to understand what is a Cron, read this article that explains it in detail: Understanding the Cron
When do I need to configure a Cron job on my server?
- The emails on your site are not being sent automatically.
- The emails on your site are not being sent on time.
- You're a Free user and you want to send at a regular frequency.
- You're a Premium user and you want to send at a higher frequency than every 5 minutes.
Some hosts remove, rename or change the access rights of the file wp-cron.php located at the root of your site (for bandwidth and performance reasons). If that's your case, activating MailPoet's Cron option won't help you. Get in touch with your host or try to re-upload a wp-cron.php file manually.
1. Activate MailPoet's Cron
The path to enable MailPoet Cron is at Settings page > Advanced tab > Geeky Options link.
Once you've activated MailPoet's Cron, there are three possible options:
- Manually setup a Cron job on your host's administration panel (cPanel or Plesk) that will access your MailPoet's Cron URL. See below how-to.
- Do nothing and your visitors will automatically trigger your WP-Cron (read how this works). This option is unreliable for low traffic websites. (Free users only)
- Do nothing and MailPoet's servers will visit your MailPoet's Cron URL every 5 minutes to trigger your WP-Cron. (Premium users only)
- If you are a Free user and can't set up a Cron Job on your server, you shoud use one of these services: EasyCron or SetCronJob.
Once MailPoet's Cron is activated, it will enhance the default WP-Cron by preventing duplicated newsletters from being sent to the same subscriber, in the event that your website gets a lot of traffic.
2. Setting up a Cron job on Your Host's Administration Panel
This is where the fun begins! Each host may use a different configuration panel.
The instructions below are from host's administration panel that uses cPanel.
2.1 Access your account's cPanel
Usually the link is http://yourwebsite.com/cpanel or http://yourwebsite.com:2082. Once your enter your user id and password and enter the control panel, scroll down to the "Advanced section".
2.2 Go to Cron Settings Page
Click on the "Cron Jobs" icon in the advanced section.
2.3 Set up a Cron Job
In the command field, you'll have to type a command that will run a program to call the MailPoet's Cron URL, which you can find in the MailPoet's Cron option in the Settings page:
Finally, click on the "Add New Cron Job" button.
From now on the server will make a request for the wp-cron.php file every 5 minutes.
2.4 Cron job commands to call MailPoet's Cron URL
Below are a few examples of commands you can use.You'll only need to set up one on your server, so simply pick the one which works on your server ( curl is safer):
curl --silent "http://www.yourwebsite.com/wp-cron.php?xxxx..." > /dev/null 2>&1
wget --quiet "http://www.yourwebsite.com/wp-cron.php?xxxx..."
Don't forget to replace http://www.yourwebsite.com/wp-cron.php?xxxx... with your own MailPoet's Cron URL.
Some hosts may allow you to set up cron commands from their admin interfaces. But, the commands wget, curl and lynx may not be available, so if the cron doesn't seem to be running, get in touch with your host and they should be able to help you out.
How do I know the Cron job is running properly?
Simply check that the scheduled emails have been sent on time.
Make sure that the sending frequency you've setup on your MailPoet installation's Settings page > Send With... tab is matching the Cron job frequency you've configured on your host administration panel.
For example, if you want to send 50 emails every minute, then you'll need to have a Cron job running every minute, like this:
Remember! As soon as you select the option " I'll setup a cron job on my server to execute at the frequency I want..." your newsletters will only be sent if that URL is visited. So, make sure that MailPoet's servers are able to reach that URL (no Firewalls are blocking it) or you have a Cron job on your host's administration panel set up to visit that URL.