无法安排发送电子邮件

时间:2015-06-16 作者:blueseal

我有一个函数,它需要4个参数来发送电子邮件,如果我简单地调用该函数,它就会工作,但当我尝试从schedule\\u single\\u event调用它时,它就不工作了。代码如下:

function send_fake_reminder($email, $other_person_id, $formatted_day, $formatted_time){
    add_filter(\'wp_mail_content_type\',create_function(\'\', \'return "text/html"; \'));
    $user_subject_eval = "Reminder for Your Lesson at ".$formatted_time." on ".$formatted_day;
    $user_message_eval = "<p>Please make sure that you have their Skype address added. </p><p>Enjoy your lesson!</p></div></div>";
    $user_headers_eval = "From: Exlogue <[email protected]>";
    wp_mail( $email, $user_subject_eval, $user_message_eval, $user_headers_eval);
}

add_action(\'send_fake_reminder\',\'send_fake_reminder\', 10, 4);


$teacher_email = \'[email protected]\';
$current_user_id = \'\';
$teacher_formatted_day = \'\';
$teacher_formatted_time = \'\';
$now = time();

//this works!
send_fake_reminder($teacher_email, $current_user_id, $teacher_formatted_day, $teacher_formatted_time);

// this doesn\'t work :(
$schedule = wp_schedule_single_event( $now, \'send_fake_reminder\', array($teacher_email, $current_user_id, $teacher_formatted_day, $teacher_formatted_time) ) ;
为什么日程安排不起作用?

1 个回复
SO网友:Oleg Butuzov

您是否尝试将其与wp_next_scheduled 吊钩的存在/工作情况?

结束

相关推荐

自定义发布类型的POST_ROW_ACTIONS

我正在使用this 在WordPress Admin中具有重复post函数的代码。但是,当我为自定义帖子类型添加过滤器时,如下所示:add_filter( \'directory_row_actions\', \'rd_duplicate_post_link\', 10, 2 ); (自定义帖子类型的注册名称为directory) - 它不会将其添加到条目标题下的操作行中。当我为帖子或页面执行此操作时,如下所示:add_filter( \'post_row_actions\', \'rd_dup