Typecho 评论邮件通知
!
Typecho不像Wordpress默认提供通知邮件,又不能时不时的看着后台.所以邮件通知就显得有必要.
背景
Typecho不像wordpress默认提供通知邮件,又不能时不时的看着后台.所以邮件通知就显得有必要,当然还可以通过微信或者tg来进行通知.不过今天我们只讨论邮件通知.
推荐CommentToMail插件
都说xx好用,结果丢到自己服务器发现这样的问题:测试邮件正常,但是正常评论却不会收到任何提示.
这里分享一份给大家,希望你不会遇到类似问题.
配置模板
将代码分别复制到插件中的 owner.html
和 guest.html
即可食用!
具体位置 控制台
-> 评论邮件提醒
-> 编辑邮件模板
guest.html
<div style="width: 550px;height: auto;border-radius: 5px;margin:0 auto;border:1px solid #ffb0b0;box-shadow: 0px 0px 20px #888888;position: relative;padding-bottom: 5px;">
<div style="width:550px;height: 50px;background-size: cover;background-repeat: no-repeat;border-radius: 5px 5px 0px 0px;"></div>
<div style="width: 200px;height: 40px;background-color: rgb(255, 114, 114);margin-top: -20px;margin-left: 20px;box-shadow: 3px 3px 3px rgba(0, 0, 0, 0.3);color: rgb(255, 255, 255);text-align: center;line-height: 40px;">Dear: {author_p}</div>
<div style="background-color:white;line-height:180%;padding:0 15px 12px;width:520px;margin:30px auto;color:#555555;font-family:'Century Gothic','Trebuchet MS','Hiragino Sans GB',微软雅黑,'Microsoft Yahei',Tahoma,Helvetica,Arial,'SimSun',sans-serif;font-size:12px;margin-bottom: 0px;">
<h2 style="border-bottom:1px solid #DDD;font-size:14px;font-weight:normal;padding:13px 0 10px 8px;"><span style="color: #12ADDB;font-weight: bold;">> </span>您在<a style="text-decoration:none;color: #12ADDB;" href="{permalink}" target="_blank">《{title}》</a>的评论有了新的回复呐~</h2>
<div style="padding:0 12px 0 12px;margin-top:18px">
<p>时间:<span style="border-bottom:1px dashed #ccc;" t="5" times=" 20:42">{time}</span></p>
<p>您的评论:</p>
<p style="background-color: #f5f5f5;border: 0px solid #DDD;padding: 10px 15px;margin:18px 0">{text_p}</p>
<p><strong>{author}</strong> 给您的回复:</p>
<p style="background-color: #f5f5f5;border: 0px solid #DDD;padding: 10px 15px;margin:18px 0">{text}</p>
</div>
</div>
<div style="color:#8c8c8c;;font-family: 'Century Gothic','Trebuchet MS','Hiragino Sans GB',微软雅黑,'Microsoft Yahei',Tahoma,Helvetica,Arial,'SimSun',sans-serif;font-size: 10px;width: 100%;text-align: center;word-wrap:break-word;margin-top: -30px;">
<p style="padding:20px;">白天要好好读书,书里有你不知道的;夜晚要好好睡觉,梦里有你想要的。</p>
</div>
<a style="text-decoration:none; color:#FFF;width: 40%;text-align: center;background-color:#ff7272;height: 40px;line-height: 35px;box-shadow: 3px 3px 3px rgba(0, 0, 0, 0.30);margin: -10px auto;display: block;" href="{permalink}" target="_blank">查看回复的完整內容</a>
<div style="color:#8c8c8c;;font-family: 'Century Gothic','Trebuchet MS','Hiragino Sans GB',微软雅黑,'Microsoft Yahei',Tahoma,Helvetica,Arial,'SimSun',sans-serif;font-size: 10px;width: 100%;text-align: center;margin-top: 30px;">
<p>本邮件为系统自动发送,请勿直接回复~</p>
</div>
<div style="color:#8c8c8c;;font-family: 'Century Gothic','Trebuchet MS','Hiragino Sans GB',微软雅黑,'Microsoft Yahei',Tahoma,Helvetica,Arial,'SimSun',sans-serif;font-size: 10px;width: 100%;text-align: center;">
<p>©2017-2019 CuiZhe's Blog</p>
</div>
</div>
owner.html
<div style="width: 550px;height: auto;border-radius: 5px;margin:0 auto;border:1px solid #ffb0b0;box-shadow: 0px 0px 20px #888888;position: relative;">
<div style="width:550px;height: 30px;background-size: cover;background-repeat: no-repeat;border-radius: 5px 5px 0px 0px;"></div>
<div style="background-color:white;line-height:180%;padding:0 15px 12px;width:520px;margin:10px auto;color:#555555;font-family:'Century Gothic','Trebuchet MS','Hiragino Sans GB',微软雅黑,'Microsoft Yahei',Tahoma,Helvetica,Arial,'SimSun',sans-serif;font-size:12px;margin-bottom: 0px;">
<h2 style="border-bottom:1px solid #DDD;font-size:14px;font-weight:normal;padding:13px 0 10px 8px;"><span style="color: #12ADDB;font-weight: bold;">> </span>您的文章<a style="text-decoration:none;color: #12ADDB;" href="{permalink}" target="_blank">《{title}》</a>有了新的回复耶~</h2>
<div style="padding:0 12px 0 12px;margin-top:18px">
<p>时间:<span style="border-bottom:1px dashed #ccc;" t="5" times=" 20:42">{time}</span></p>
<p><strong>{author}</strong> 给您的评论:</p>
<p style="background-color: #f5f5f5;border: 0px solid #DDD;padding: 10px 15px;margin:18px 0">{text}</p>
<p>其他信息:</p>
<p style="background-color: #f5f5f5;border: 0px solid #DDD;padding: 10px 15px;margin:18px 0">IP:{ip}<br />邮箱:<a href="mailto:{mail}">{mail}</a><br />状态:{status} [<a href='{manage}' target='_blank'>管理评论</a>]</p>
</div>
</div>
<a style="text-decoration: none;color: rgb(255, 255, 255);width: 40%;text-align: center;background-color: rgb(255, 114, 114);height: 40px;line-height: 40px;box-shadow: 3px 3px 3px rgba(0, 0, 0, 0.3);display: block;margin: auto;" href="{permalink}" target="_blank">查看回复的完整內容</a>
<div style="color:#8c8c8c;;font-family: 'Century Gothic','Trebuchet MS','Hiragino Sans GB',微软雅黑,'Microsoft Yahei',Tahoma,Helvetica,Arial,'SimSun',sans-serif;font-size: 10px;width: 100%;text-align: center;">
<p>©2017-2019 CuiZhe's Blog</p>
</div>
</div>
使用上面模板发现手机部分内容会溢出,不是很友好,于是又修改了一番,不足之处还望指正.
新guest.html
<div style="width:550px;height:auto;border-radius:5px;margin:0 auto;border:1px solid #ffb0b0;box-shadow:0 0 20px #888;position:relative;padding-bottom:5px;margin-top:30px"><tbody><tr><td><table cellpadding="0" cellspacing="0" class="padding" width="100%" style="padding-left:40px;padding-right:40px;padding-top:30px;padding-bottom:5px"><tbody><tr class="Dear"><div style="width:200px;height:40px;background-color:#ff7272;margin-top:-20px;margin-left:20px;box-shadow:3px 3px 3px rgba(0,0,0,.3);color:#fff;text-align:center;line-height:40px">Dear: {author_p}</div><td align="center"><table class="logo" style="margin-bottom:10px"><tbody><tr><td></td></tr></tbody></table></td></tr><tr class="content"><td><h2 style="border-bottom:1px solid #ddd;font-size:16px;font-weight:400;padding:13px 0 10px 8px"><span style="color:#12addb;font-weight:700">> </span>您在<a style="text-decoration:none;color:#12addb" href="{permalink}" target="_blank">《{title}》</a>中有了新的回复呐~</h2><p>时间:<span style="border-bottom:1px dashed #ccc" t="5" times=" 20:42">{time}</span></p><p>您的评论:</p><p style="background:#eee;padding:1em;text-indent:2em;line-height:30px;font-size:14px">{text_p}</p><p><strong>{author}</strong> 给您的回复:</p><p style="background:#eee;padding:1em;text-indent:2em;line-height:30px;font-size:14px">{text}</p></td></tr><tr><td align="center"><table cellpadding="12" border="0" style="font-family:Lato,'Lucida Sans','Lucida Grande',SegoeUI,'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:14px;font-weight:700;line-height:25px;color:#444;text-align:left"><tbody><tr><td style="text-align:center"><a target="_blank" style="color:#fff;background:#ff7272;box-shadow:0 5px 20px -10px #ff7272;border:1px solid #ff7272;width:200px;font-size:14px;padding:10px 0;border-radius:2px;margin:10% 0 5%;text-align:center;display:inline-block;text-decoration:none" href="{permalink}">查看回复的完整內容</a></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody><table border="0" cellpadding="0" cellspacing="0" align="center" class="footer" style="max-width:550px;font-family:Lato,'Lucida Sans','Lucida Grande',SegoeUI,'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:14px;line-height:22px;color:#444;text-align:left;padding:20px 0;font-weight:400"><tbody><tr><td style="text-align:center"></td></tr><tr><td style="text-align:center;font-weight:400;font-size:12px;line-height:18px;color:#a3a3a3;padding:5px 0"><p>本邮件为系统自动发送,请勿直接回复<br>Please do not reply to this message , because it is automatically sent.</p><p>©2019 <a name="footer_copyright" href="https://cuizhe.me" style="color:#2b88d9;text-decoration:none" target="_blank">CuiZhe's Blog</a></p></td></tr></tbody></table></div>
新owner.html
<div style="width:550px;height:auto;border-radius:5px;margin:0 auto;border:1px solid #ffb0b0;box-shadow:0 0 20px #888;position:relative;padding-bottom:5px;margin-top:30px"><tbody><tr><td><table cellpadding="0" cellspacing="0" class="padding" width="100%" style="padding-left:40px;padding-right:40px;padding-top:30px;padding-bottom:5px"><tbody><tr class="logo"><td align="center"><table class="logo" style="margin-bottom:10px"><tbody><tr><td></td></tr></tbody></table></td></tr><tr class="content"><td><h2 style="border-bottom:1px solid #ddd;font-size:16px;font-weight:400;padding:13px 0 10px 8px"><span style="color:#12addb;font-weight:700">> </span>您在<a style="text-decoration:none;color:#12addb" href="{permalink}" target="_blank">《{title}》</a>中有了新的回复呐~</h2><p>时间:<span style="border-bottom:1px dashed #ccc" t="5" times=" 20:42">{time}</span></p><p><strong>{author}</strong> 给您的评论:</p><p style="background:#eee;padding:1em;text-indent:2em;line-height:30px;font-size:14px">{text}</p><p>其他信息:</p><p style="background:#eee;padding:1em;line-height:30px;font-size:14px">IP:{ip}<br>邮箱:<a href="mailto:{mail}">{mail}</a><br>状态:{status} [<a href="{manage}" target="_blank">管理评论</a>]</p></td></tr><tr><td align="center"><table cellpadding="12" border="0" style="font-family:Lato,'Lucida Sans','Lucida Grande',SegoeUI,'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:14px;font-weight:700;line-height:25px;color:#444;text-align:left"><tbody><tr><td style="text-align:center"><a target="_blank" style="color:#fff;background:#ff7272;box-shadow:0 5px 20px -10px #ff7272;border:1px solid #ff7272;width:200px;font-size:14px;padding:10px 0;border-radius:2px;margin:10% 0 5%;text-align:center;display:inline-block;text-decoration:none" href="{permalink}">查看回复的完整內容</a></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody><table border="0" cellpadding="0" cellspacing="0" align="center" class="footer" style="max-width:550px;font-family:Lato,'Lucida Sans','Lucida Grande',SegoeUI,'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:14px;line-height:22px;color:#444;text-align:left;padding:20px 0;font-weight:400"><tbody><tr><td style="text-align:center"></td></tr><tr><td style="text-align:center;font-weight:400;font-size:12px;line-height:18px;color:#a3a3a3;padding:5px 0"><center><p>本邮件为系统自动发送,请勿直接回复<br>Please do not reply to this message , because it is automatically sent.</p></center><p>©2019 <a name="footer_copyright" href="https://cuizhe.me" style="color:#2b88d9;text-decoration:none" target="_blank">CuiZhe's Blog</a></p></td></tr></tbody></table></div>
我奔溃了,不是手机客户端样式不对就是微信邮箱样式问题.....
20190922-guest.html
<div style="font:Verdana normal 14px;color:#000"><div style="position:relative"><div style="color:#555;font:12px/1.5 Hiragino Sans GB,Microsoft Yahei,SimSun,Helvetica,Arial,Sans-serif;width:600px;margin:50px auto;border:1px solid #e9e9e9;border-top:none"><table border="0" cellspacing="0" cellpadding="0"><tbody><tr valign="top" height="2"><td width="190" bgcolor="#0B9938"></td><td width="120" bgcolor="#9FCE67"></td><td width="85" bgcolor="#EDB113"></td><td width="85" bgcolor="#FFCC02"></td><td width="130" bgcolor="#5B1301" valign="top"></td></tr></tbody></table><div style="padding:0 15px 8px"><h2 style="border-bottom:1px solid #e9e9e9;font-size:14px;font-weight:400;padding:10px 0 10px"><span style="color:#12addb">></span> Dear: {author_p}<br>您在《{title}》的评论有新回复啦!</h2><div style="font-size:12px;color:#777;padding:0 10px;margin-top:18px"><p></p><div style="font-size:12px;color:#777;padding:0 10px;margin-top:18px"><p>时间:{time}<br>您的评论:</p><p style="background:#f5f5f5;padding:10px 15px;margin:18px 0">{text_p}</p><p>{author} 给您的回复:</p><p style="background:#f5f5f5;padding:10px 15px;margin:18px 0">{text}</p><p>您可以 <a style="text-decoration:none;color:#12addb" href="{permalink}" title="点击查看完整的回复内容" target="_blank">点击查看完整的回复内容</a>,欢迎再次光临 <a style="text-decoration:none;color:#12addb" href="https://cuizhe.me" title="CuiZhe's Blog" target="_blank">CuiZhe's Blog</a>.</p></div></div><div style="color:#888;padding:10px;border-top:1px solid #e9e9e9;background:#f5f5f5"><p style="margin:0;padding:0"></p><p>本邮件为系统自动发送,请勿直接回复<br>Please do not reply to this message , because it is automatically sent.</p><p></p></div></div></div></div><!--<![endif]--></div>
20190922-owner.html
<div style="font:Verdana normal 14px;color:#000"><div style="position:relative"><div style="color:#555;font:12px/1.5 Hiragino Sans GB,Microsoft Yahei,SimSun,Helvetica,Arial,Sans-serif;width:600px;margin:50px auto;border:1px solid #e9e9e9;border-top:none"><table border="0" cellspacing="0" cellpadding="0"><tbody><tr valign="top" height="2"><td width="190" bgcolor="#0B9938"></td><td width="120" bgcolor="#9FCE67"></td><td width="85" bgcolor="#EDB113"></td><td width="85" bgcolor="#FFCC02"></td><td width="130" bgcolor="#5B1301" valign="top"></td></tr></tbody></table><div style="padding:0 15px 8px"><h2 style="border-bottom:1px solid #e9e9e9;font-size:14px;font-weight:400;padding:10px 0 10px"><span style="color:#12addb">></span> 您在《{title}》中有新回复啦!</h2><div style="font-size:12px;color:#777;padding:0 10px;margin-top:18px"><p>时间:{time}</p><div style="font-size:12px;color:#777;padding:0 10px;margin-top:18px"><p>给您的评论:</p><p style="background:#f5f5f5;padding:10px 15px;margin:18px 0">{text}</p><p>其他信息:</p><p style="background:#f5f5f5;padding:10px 15px;margin:18px 0">IP:{ip}<br>邮箱:{mail}<br>状态:{status} [<a href="{manage}" target="_blank">管理评论</a>]</p><p></p><p>您可以 <a style="text-decoration:none;color:#12addb" href="{permalink}" title="点击查看完整的回复内容" target="_blank">点击查看完整的回复内容</a>,欢迎再次光临 <a style="text-decoration:none;color:#12addb" href="https://cuizhe.me" title="CuiZhe's Blog" target="_blank">CuiZhe's Blog</a>.</p></div></div><div style="color:#888;padding:10px;border-top:1px solid #e9e9e9;background:#f5f5f5"><p style="margin:0;padding:0"></p><p>本邮件为系统自动发送,请勿直接回复<br>Please do not reply to this message , because it is automatically sent.</p><p></p></div></div></div></div><!--<![endif]--></div>
CommentToMail插件注意事项
使用过程中发现如果在后台设置了评论者之前须有评论通过了审核
,那么被回复消息的用户是无法收到邮件通知的即使你在通过评论审核后!
扩展链接
W3School在线测试工具 V2 - 传送阵
在线代码运行工具 - 传送阵
tool.lu在线工具 - 传送阵
推荐一款CommentToMail邮件插件的模板 - 传送阵
[Typecho]邮件提醒模板 - 传送阵
首次创建时间:2019-03-10 00:30:00
最后修改时间:2019-09-22 22:13:10
_(:3 」∠)_