These are the steps that I followed to set up my CRON :
define('DISABLE_WP_CRON', true);
added in wp-config.php
fileWP Control
and Added a Hook lead_mail_gun
. add_action( 'lead_mail_gun', 'cron_test_function' );
function cron_test_function() {
$email = 'my-mail-id';
$headers = 'From: '. $email . "\r\n" .
'Reply-To: ' . $email . "\r\n";
wp_mail('my-mail-id', 'WP Crontrol', 'WP Crontrol rocks!', $headers);
}
The DISABLE_WP_CRON constant is set to true. WP-Cron spawning is disabled.
which confirms that default CRON is off/usr/local/php72/bin/php /home/path_to_my_cron_file/wp-cron.php
running every 10 mins. I am getting no emails. What can be the cause of emails not being sent ?
I have tested that I can send emails though my server.
So the fix was simple.
Use the following in the command section of CRON.
curl https://www.example.com/wp-cron.php