【发布时间】:2019-09-30 20:59:01
【问题描述】:
这些是我设置 CRON 的步骤:
-
define('DISABLE_WP_CRON', true);添加到wp-config.php文件中 - 已安装
WP Control并添加了 Hooklead_mail_gun。 - 在我的代码 sn-ps 中添加了以下代码。
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);
}
- 我可以在 CRON 事件列表中看到我的功能。
- 我还可以看到
The DISABLE_WP_CRON constant is set to true. WP-Cron spawning is disabled.确认默认 CRON 已关闭 - 在我的dreamhost 中,我添加了一个CRON 作业,使用以下命令
/usr/local/php72/bin/php /home/path_to_my_cron_file/wp-cron.php每10 分钟运行一次。
我没有收到任何电子邮件。没有发送电子邮件的原因可能是什么?
我已经测试过我可以通过我的服务器发送电子邮件。
【问题讨论】: