无法运行dreamhost cron作业以在wordpress网站上发送电子邮件

问题描述 投票:0回答:1

这些是我设置CRON所遵循的步骤:

  1. [define('DISABLE_WP_CRON', true);已添加到wp-config.php文件中]
  2. 已安装WP Control并添加了挂钩lead_mail_gun
  3. 在我的代码段中添加了以下代码。
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);
}
  1. 我可以在CRON事件列表中看到我的功能。
  2. 也可以看到The DISABLE_WP_CRON constant is set to true. WP-Cron spawning is disabled.确认默认CRON已关闭
  3. 在我的Dreamhost中,我添加了一个CRON作业,每10分钟运行以下命令/usr/local/php72/bin/php /home/path_to_my_cron_file/wp-cron.php

我没有收到电子邮件。电子邮件无法发送的原因可能是什么?

我已经测试过可以通过服务器发送电子邮件。

wordpress cron dreamhost
1个回答
0
投票

因此修复很简单。

在CRON的命令部分中使用以下内容。

curl https://www.example.com/wp-cron.php

© www.soinside.com 2019 - 2024. All rights reserved.