惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

The Last Watchdog
The Last Watchdog
Microsoft Security Blog
Microsoft Security Blog
宝玉的分享
宝玉的分享
小众软件
小众软件
雷峰网
雷峰网
F
Full Disclosure
B
Blog
Hugging Face - Blog
Hugging Face - Blog
GbyAI
GbyAI
月光博客
月光博客
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
TaoSecurity Blog
TaoSecurity Blog
博客园 - 聂微东
P
Palo Alto Networks Blog
N
Netflix TechBlog - Medium
S
Secure Thoughts
Google Online Security Blog
Google Online Security Blog
P
Privacy & Cybersecurity Law Blog
U
Unit 42
Cloudbric
Cloudbric
Know Your Adversary
Know Your Adversary
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Vercel News
Vercel News
博客园 - Franky
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
N
News and Events Feed by Topic
T
Tailwind CSS Blog
S
Schneier on Security
IT之家
IT之家
P
Proofpoint News Feed
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
T
Tenable Blog
Google DeepMind News
Google DeepMind News
The GitHub Blog
The GitHub Blog
T
Troy Hunt's Blog
V2EX - 技术
V2EX - 技术
Cyberwarzone
Cyberwarzone
P
Privacy International News Feed
I
InfoQ
MongoDB | Blog
MongoDB | Blog
Project Zero
Project Zero
B
Blog RSS Feed
Help Net Security
Help Net Security
H
Heimdal Security Blog
有赞技术团队
有赞技术团队
The Register - Security
The Register - Security
V
V2EX
C
CXSECURITY Database RSS Feed - CXSecurity.com
J
Java Code Geeks

郭泽宇的博客 (@ZE3kr)

Hertz 租车被讨债总结,我起诉讨债公司的经历 | ZE3kr 在 iPad 上运行 macOS? (with Jump Desktop) Vision Pro 首发体验 | ZE3kr 低价冷数据存储方案 - Lightsail + S3 + Nextcloud 实现 $1/TB/月 谈一谈阿里云香港的宕机 | ZE3kr 云服务推荐及选择指南 | ZE3kr 从零开始建立自己的域名和企业邮箱 | ZE3kr 本站改版后的架构与优化——Hexo,分区解析,CDN,图像压缩等 | ZE3kr 毫米波 5G 有多快? 2000Mbps! 快来看看你的 iPhone 是否支持毫米波 Mac mini 有什么用?组建家庭服务器! | ZE3kr Magic Keyboard (妙控键盘) for iPad Pro 使用体验 自建 PowerDNS 进阶:分区解析,dnsdist,Lua 记录 | ZE3kr SSD U盘、Windows To Go 与 Mac WordPress 5.0 更新现已发布,全新编辑器,全新主题 | ZE3kr Azure DNS、NS1、Constellix,三家海外 GeoDNS 服务商对比 | ZE3kr Mac 上一些精致实用的软件推荐 | ZE3kr 谈谈数据备份 | ZE3kr DNSSEC 简介,签名的工作原理 | ZE3kr Cloudflare Argo 与 Railgun 对比测试,CDN 加速的黑科技 几个免费的服务器监控服务推荐 | ZE3kr 国内外几家全站 CDN 对比 | ZE3kr 2017 年,再看 SSL 和 HTTPS 关于建站和服务选购的一些建议 | ZE3kr DNS 域名解析系统详解——基础篇 | ZE3kr 修复 WordPress 2017 主题中奇怪字形的 Bug 使用 AMP 构建超快的移动页面 | ZE3kr 利用 GCE 建立一个 Anycast 网络,超快的香港节点,Google Cloud CDN Cloudflare 的全新功能体验——Load Balancing、Rate Limiting | ZE3kr Google Compute Engine 新手教程及使用体验 | ZE3kr 使用免费 Let's Encrypt 实现 ECDSA/RSA 双证书 如何配置以实现纯 IPv6-Only 网络访问 | ZE3kr 自建 PowerDNS 智能解析服务器 | ZE3kr 在自己服务器上安装 GitLab,代替 GitHub! | ZE3kr 几个 WordPress 的加速建议 | ZE3kr CloudXNS、Route 53、阿里云解析等 DNS 服务的全面对比 | ZE3kr 从沙州中学到家 | ZE3kr 从家到沙州中学 | ZE3kr 谈谈视频在互联网上的流播 | ZE3kr 佳能发布新 APS-C 机型 EOS 80D,强悍视频录制、全新的对焦系统和 CMOS WordPress 上的几个推荐安装的插件 | ZE3kr Matomo 与 WordPress 配合使用,建立强大统计系统 | ZE3kr TL-PA500 电力猫,部署无线局域网集群 | ZE3kr 为何要使用一个 CDN 服务? | ZE3kr 静态网页的优与劣 | ZE3kr 全面 HTTPS 时代即将到来 | ZE3kr Withings Activité Pop 智能手表推荐,睡眠跟踪、运动记录、智能闹钟 | ZE3kr DELL P2415Q 4K 显示器推荐 | ZE3kr 好搜所做的恶心事 | ZE3kr 使用 srcset + sizes 属性与 w 标识符解决一切响应式图片问题 Eyefi Mobi 立刻让你的相机支持 Wi-Fi | ZE3kr 移动优先 – 速度 | ZE3kr MacID 让 iPhone 指纹解锁苹果电脑 | ZE3kr ProCamera – iPhone 照相软件推荐 | ZE3kr 移动优先 – 起源 | ZE3kr
用回 WordPress 自带评论系统 | ZE3kr
2016-08-22 · via 郭泽宇的博客 (@ZE3kr)

最近 Disqus 被某国的墙搞的十分不稳定,于是又用回了 WordPress 自带的评论系统,但是这个评论系统却不带评论者被回复时的邮件提醒。我有自己的发信服务器(AWS SES)系统,所以理论上可以配合插件实现这个效果。但是我看了很多插件,基本上操作页面都太复杂,而且回复的邮件通常不支持中文,我只需要一个简单的回复系统,不用那么麻烦,于是干脆自己开发一个,最终比较完美的实现了这个功能。

我开发的这个功能特点是:当评论者被回复时,邮件标题是 “Re: [文章标题]”,这样评论者的一个留言被多个人回复时,会被自动在本地邮件客户端上归为一类;而且评论者收到邮件后可以直接回复邮件,会直接给回复的发出者发邮件(不会显示在网站上,我也无法看到,这将是两人的私聊)。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php
function tlo_comment_mail_notify($comment_id) {
global $comment_author;
$comment = get_comment($comment_id);
$parent_id = $comment->comment_parent ? $comment->comment_parent : '';
$spam_confirmed = $comment->comment_approved;
$from = $comment->comment_author_email;
$to = get_comment($parent_id)->comment_author_email;
if (($parent_id != '') && ($spam_confirmed != 'spam') && $from != $to && $to != get_bloginfo('admin_email') ) {
$blog_name = get_option('blogname');
$blog_url = site_url();
$post_url = get_permalink( $comment->comment_post_ID );
$comment_author = $comment->comment_author;
$subject = 'Re: '.html_entity_decode(get_the_title($comment->comment_post_ID));
$headers[] = 'Reply-To: '.$comment_author.' <'.$comment->comment_author_email.'>';
$comment_parent = get_comment($parent_id);
$comment_parent_date = tlo_get_comment_date( $comment_parent );
$comment_parent_time = tlo_get_comment_time( $comment_parent );
$message = <<<HTML
<!DOCTYPE html>
<html lang="zh">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>$blog_name</title>
</head>
<body>
<style type="text/css">
img {
max-width: 100%; height: auto;
}
</style>
<div class="content">
<div>
<p>$comment->comment_content</p>
</div>
</div>
<div class="footer" style="margin-top: 10px">
<p style="color: #777; font-size: small">
&mdash;
<br>
Reply to this email to communicate with replier directly, or <a href="$post_url#comment-$comment_id">view it on $blog_name</a>.
<br>
You're receiving this email because of your comment got replied.
</p>
</div>
<blockquote type="cite">
<div>On {$comment_parent_date}, {$comment_parent_time},$comment_parent->comment_author &lt;<a href="mailto: $comment_parent->comment_author_email">$comment_parent->comment_author_email</a>&gt; wrote:</div>
<br>
<div class="content">
<div>
<p>$comment_parent->comment_content</p>
</div>
</div>
</blockquote>
</body>
</html>
HTML;
add_filter( 'wp_mail_content_type', 'tlo_mail_content_type' );
add_filter( 'wp_mail_from_name', 'tlo_mail_from_name' );
wp_mail( $to, $subject, $message, $headers );
}
}
add_action('tlo_comment_post_async', 'tlo_comment_mail_notify');

function tlo_comment_mail_notify_async($comment_id) {
wp_schedule_single_event( time(), 'tlo_comment_post_async', [$comment_id] );
}
add_action('comment_post', 'tlo_comment_mail_notify_async');
// add_action('comment_post', 'tlo_comment_mail_notify');

function tlo_mail_content_type() {
return 'text/html';
}
function tlo_mail_from_name() {
global $comment_author;
return $comment_author;
}

function tlo_get_comment_time( $comment ) {
$date = mysql2date(get_option('time_format'), $comment->comment_date, true);

return apply_filters( 'tlo_get_comment_time', $date, $comment );
}
function tlo_get_comment_date( $comment ) {
$date = mysql2date(get_option('date_format'), $comment->comment_date);

return apply_filters( 'tlo_get_comment_date', $date, $comment );
}