diff --git a/email-templates/base.php b/email-templates/base.php index 4d550e9..9cb8fe8 100644 --- a/email-templates/base.php +++ b/email-templates/base.php @@ -97,6 +97,25 @@ function argon_get_email_types() { 'theme_color' => __('主题色', 'argon'), ), ), + 'todo_urge' => array( + 'name' => __('TODO 提醒', 'argon'), + 'description' => __('访客催促作者完成 TODO 时发送的邮件', 'argon'), + 'default_subject' => '[{{blog_name}}] 有人催你完成 TODO', + 'default_content' => '
📝 {{todo_content}}
+快去完成吧!
+前往博客', + 'placeholders' => array( + 'blog_name' => __('博客名称', 'argon'), + 'blog_url' => __('博客链接', 'argon'), + 'todo_content' => __('TODO 内容', 'argon'), + 'todo_id' => __('TODO ID', 'argon'), + 'urge_time' => __('提醒时间', 'argon'), + 'theme_color' => __('主题色', 'argon'), + ), + ), 'general' => array( 'name' => __('通用邮件', 'argon'), 'description' => __('其他类型的通用邮件模板', 'argon'), @@ -445,6 +464,13 @@ function argon_get_sample_email_vars($type) { 'reset_url' => home_url('/wp-login.php?action=rp&key=sample_key'), )); + case 'todo_urge': + return array_merge($common, array( + 'todo_content' => '这是一个示例 TODO 任务内容', + 'todo_id' => 'sample_todo_id', + 'urge_time' => date_i18n(get_option('date_format') . ' ' . get_option('time_format')), + )); + case 'general': default: return array_merge($common, array( diff --git a/functions.php b/functions.php index 5bbebdb..49f2fed 100644 --- a/functions.php +++ b/functions.php @@ -3754,25 +3754,15 @@ function argon_ajax_urge_todo() { wp_send_json_error(__('TODO 不存在', 'argon')); } - // 使用主题内置的邮件发送接口 + // 使用邮件模板系统发送 $admin_email = get_option('admin_email'); - $site_name = get_bloginfo('name'); - $site_url = get_bloginfo('url'); + $vars = array( + 'todo_content' => $todo_content, + 'todo_id' => $id, + 'urge_time' => date_i18n(get_option('date_format') . ' ' . get_option('time_format')), + ); - $subject = '[' . $site_name . '] ' . __('有人催你完成 TODO', 'argon'); - $html = ' -📝 ' . esc_html($todo_content) . '
-' . __('快去完成吧!', 'argon') . '
-' . __('来自', 'argon') . ' ' . $site_name . '
-