View Categories

Setting Up a Server-Side Cron for Smithy Factory Emailer

3 min read

Smithy Factory Emailer relies on scheduled tasks (called “cron jobs”) to send emails in batches. By default, WordPress uses “WP-Cron,” which only runs when someone visits your site. For reliable, timely email delivery—especially for large batches—we recommend setting up a real server-side cron job.


Why Use a Real Cron Job?

  • Reliability: Emails are sent on schedule, even if your site has low traffic.
  • Performance: Reduces the load on your site during user visits.
  • Control: You can set the exact frequency for processing email batches.

Step 1: Disable WP-Cron (Optional but Recommended)

To avoid duplicate or overlapping jobs, disable the default WordPress cron system:

  1. Open your wp-config.php file (in your WordPress root directory).
  2. Add this line before /* That's all, stop editing! */:
define('DISABLE_WP_CRON', true);

Step 2: Find Your WP-Cron URL

You’ll need to call the WordPress cron script directly. The URL is usually:

https://yourdomain.com/wp-cron.php?doing_wp_cron

Replace yourdomain.com with your actual site address.


Step 3: Set Up the Cron Job on Your Server

You can set up a cron job using your hosting control panel (like cPanel, Plesk, or DirectAdmin) or via SSH.

Example Cron Command (every 5 minutes):

*/5 * * * * wget -q -O - https://yourdomain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1

Or, using curl:

*/5 * * * * curl -s https://yourdomain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1
  • Set the frequency to match or be more frequent than your Smithy Factory Emailer batch interval (see below).
  • Most users set this to every 5 minutes (*/5 * * * *).

Step 4: Smithy Factory Emailer Batch Settings

  • Go to System Settings in the plugin menu.
  • Set Emails Per Batch and Minutes Between Batches to values that suit your server and audience size.
  • The cron job frequency should be equal to or less than the “Minutes Between Batches” setting for best results.

Step 5: Test Your Setup

  • Schedule a test email batch in Smithy Factory Emailer.
  • Check the Email Jobs page to see if batches are being processed on time.
  • If emails are not sending, double-check your cron job and make sure DISABLE_WP_CRON is set correctly.

Troubleshooting

  • If emails are delayed or not sending, check your server’s cron log (or ask your host for help).
  • Make sure your cron command uses the correct site URL and is not blocked by security plugins or firewalls.
  • Check the WordPress debug log for any plugin errors.
  • Ensure your batch size and interval are not too aggressive for your hosting plan.

Advanced: WP-CLI Alternative

If your host supports wp-cli, you can run cron jobs with:

*/5 * * * * cd /path/to/your/site && wp cron event run --due-now >/dev/null 2>&1

Summary

  • Set up a real cron job for reliable, scheduled email sending.
  • Disable WP-Cron in wp-config.php for best results.
  • Match your cron frequency to your plugin’s batch interval.
  • Monitor the Email Jobs page to ensure everything is working smoothly.

For more help, contact your hosting provider or site administrator.