Lan Tian @ Blog

CommentToMail 修改版

本文写于 572 天前, 随着软件更新、外部链接失效等原因,这些内容可能已经不再适用。 如果你发现这些问题,欢迎在评论区指出。

最近突然发现本来每天一封的自建贴吧签到系统的邮件突然没有了,但是贴吧还是正常签到。上 Mailgun 界面一看,状态全线飘红:

Mailgun 状态

日志里一大排发往我自己 Outlook 邮箱的退信,比如:

Mailgun 日志

看提示是 Mailgun 的整个 AS 都被 Outlook 拉黑了。这下子是完全没法用了。

好消息是,有许多和 Mailgun 提供类似服务的邮件服务商,例如 SendGrid。我很快在他们网站上注册了一个账号,并且开启了 SMTP,把我的贴吧签到、NextCloud 等都接了进去,非常顺利。

坏消息是,我的博客用的是我专门给 Mailgun 写的 CommentGun,需要修改一下才能接到 SendGrid 上。

本来我可能修改一下插件,然后又能出一个 CommentGrid 之类的插件,但是每家邮件服务商的 API 都不一样。如果这些服务商轮着被 Outlook 屏蔽……画美不看。

另一个好消息是,这些邮件服务商普遍支持 SMTP 发信。这意味着我可以用 CommentToMail。坏消息是,这个插件年久失修,在不少情况下会 GG(例如网站开了 SSL,或者邮件服务商的 SSL 过期了)。

不过长痛不如短痛,比起做一大堆 Comment 开头的插件,我还是直接改好 CommentToMail,一劳永逸。基于这里和王忘杰的讨论以及我自己在 CommentGun 上的修改,我终于修好了 CommentToMail。

改动列表:

  1. 去除异步发送(许多情况下邮件发不出去就是它造成的)
  2. 更新 PHPMailer,并关闭 SSL 证书验证(部分邮件商 SMTP 没配置好,开着验证会出问题)

因为去掉了异步发送,所以如果到 SMTP 服务器的连接很慢会卡网站访问速度。我的解决方法是在 VPS 上装了个 Postfix 来中继邮件。

最后,GitHub 项目地址:https://github.com/xddxdd/typecho-commenttomail

版权所有 2019 Lan Tian @ Blog

本文链接 https://lantian.pub/article/modify-website/comment-to-mail-modified.lantian

CC BY-NC-SA 4.0 协议授权,转载请署名,禁止商业用途,请勿曲解原义

Lan Tian @ Blog 提醒您:

文章千万字,署名第一字。转载不规范,作者两行泪。

 

树莓派 3B 折腾笔记
下一篇文章:»
  1. 王忘杰

    王忘杰


    Warning: unpack(): Type V: not enough input, need 4, have 0 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 158

    Warning: unpack(): Type V: not enough input, need 4, have 0 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 158

    Warning: unpack(): Type V: not enough input, need 4, have 1 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 473

    Warning: unpack(): Type V: not enough input, need 4, have 0 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 158

    Warning: unpack(): Type V: not enough input, need 4, have 1 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 473

    Warning: unpack(): Type V: not enough input, need 4, have 0 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 158
      
    2017-10-06 09:26:18 沙发 回复 2017-10-06 09:26

    大佬 有人做了个通过网站监控触发的 https://9sb.org/58

  2. 王忘杰

    王忘杰


    Warning: unpack(): Type V: not enough input, need 4, have 1 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 473

    Warning: unpack(): Type V: not enough input, need 4, have 0 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 158

    Warning: unpack(): Type V: not enough input, need 4, have 1 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 473

    Warning: unpack(): Type V: not enough input, need 4, have 0 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 158
      
    2017-10-06 09:27:40 板凳 回复 2017-10-06 09:27

    你这评论 一点就卡住了

    1. Lan Tian

      Lan Tian


      Warning: unpack(): Type V: not enough input, need 4, have 1 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 473

      Warning: unpack(): Type V: not enough input, need 4, have 0 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 158

      Warning: unpack(): Type V: not enough input, need 4, have 1 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 473

      Warning: unpack(): Type V: not enough input, need 4, have 0 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 158
        
      2017-10-06 10:30:39 回复 2017-10-06 10:30

      评论js和新加的一些功能冲突了,现在已经修复

      1. 王忘杰

        王忘杰


        Warning: unpack(): Type V: not enough input, need 4, have 1 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 473

        Warning: unpack(): Type V: not enough input, need 4, have 0 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 158

        Warning: unpack(): Type V: not enough input, need 4, have 1 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 473

        Warning: unpack(): Type V: not enough input, need 4, have 0 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 158
          
        2017-10-07 17:08:16 回复 2017-10-07 17:08

        你的回复没有邮件通知

        1. Lan Tian

          Lan Tian


          Warning: unpack(): Type V: not enough input, need 4, have 1 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 473

          Warning: unpack(): Type V: not enough input, need 4, have 0 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 158

          Warning: unpack(): Type V: not enough input, need 4, have 1 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 473

          Warning: unpack(): Type V: not enough input, need 4, have 0 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 158
            
          2017-10-07 17:19:28 回复 2017-10-07 17:19

          邮件记录显示通知发出去了,应该是又被QQ邮箱干掉了

  3. 叶奕

    叶奕


    Warning: unpack(): Type V: not enough input, need 4, have 1 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 473

    Warning: unpack(): Type V: not enough input, need 4, have 0 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 158

    Warning: unpack(): Type V: not enough input, need 4, have 1 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 473

    Warning: unpack(): Type V: not enough input, need 4, have 0 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 158
      
    2019-01-31 14:05:00 地毯 回复 2019-01-31 14:05

    果然是dalao……顺带一说,CC BY-NC-SA 4.0是**不禁止修改**的,只需要保证使用相同方式(CC BY-NC-SA)共享来着……禁止修改是CC *-ND

  4. 叶奕

    叶奕


    Warning: unpack(): Type V: not enough input, need 4, have 1 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 473

    Warning: unpack(): Type V: not enough input, need 4, have 0 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 158

    Warning: unpack(): Type V: not enough input, need 4, have 1 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 473

    Warning: unpack(): Type V: not enough input, need 4, have 0 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 158
      
    2019-01-31 14:05:00 4 楼 回复 2019-01-31 14:05

    果然是dalao……顺带一说,CC BY-NC-SA 4.0是**不禁止修改**的,只需要保证使用相同方式(CC BY-NC-SA)共享来着……禁止修改是CC *-ND

    1. 叶奕

      叶奕


      Warning: unpack(): Type V: not enough input, need 4, have 1 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 473

      Warning: unpack(): Type V: not enough input, need 4, have 0 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 158

      Warning: unpack(): Type V: not enough input, need 4, have 1 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 473

      Warning: unpack(): Type V: not enough input, need 4, have 0 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 158
        
      2019-01-31 14:05:47 回复 2019-01-31 14:05

      哇,双倍的发包,双倍的快乐

    2. 叶奕

      叶奕


      Warning: unpack(): Type V: not enough input, need 4, have 1 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 473

      Warning: unpack(): Type V: not enough input, need 4, have 0 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 158

      Warning: unpack(): Type V: not enough input, need 4, have 1 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 473

      Warning: unpack(): Type V: not enough input, need 4, have 0 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 158
        
      2019-01-31 14:05:47 回复 2019-01-31 14:05

      哇,双倍的发包,双倍的快乐

    3. Lan Tian

      Lan Tian


      Warning: unpack(): Type V: not enough input, need 4, have 1 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 473

      Warning: unpack(): Type V: not enough input, need 4, have 0 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 158

      Warning: unpack(): Type V: not enough input, need 4, have 1 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 473

      Warning: unpack(): Type V: not enough input, need 4, have 0 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 158
        
      2019-01-31 14:15:14 回复 2019-01-31 14:15

      谢谢你的提醒,已经修改了。不过我想表达的本意是“戏说不是胡说,改编不是乱编”,不是严格的禁止修改。

    4. Lan Tian

      Lan Tian


      Warning: unpack(): Type V: not enough input, need 4, have 1 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 473

      Warning: unpack(): Type V: not enough input, need 4, have 0 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 158

      Warning: unpack(): Type V: not enough input, need 4, have 1 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 473

      Warning: unpack(): Type V: not enough input, need 4, have 0 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 158
        
      2019-01-31 14:16:11 回复 2019-01-31 14:16

      另外你重复评论是因为点了两下吗?

    5. Lan Tian

      Lan Tian


      Warning: unpack(): Type V: not enough input, need 4, have 1 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 473

      Warning: unpack(): Type V: not enough input, need 4, have 0 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 158

      Warning: unpack(): Type V: not enough input, need 4, have 1 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 473

      Warning: unpack(): Type V: not enough input, need 4, have 0 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 158
        
      2019-01-31 14:16:11 回复 2019-01-31 14:16

      另外你重复评论是因为点了两下吗?

      1. Lan Tian

        Lan Tian


        Warning: unpack(): Type V: not enough input, need 4, have 1 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 473

        Warning: unpack(): Type V: not enough input, need 4, have 0 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 158

        Warning: unpack(): Type V: not enough input, need 4, have 1 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 473

        Warning: unpack(): Type V: not enough input, need 4, have 0 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 158
          
        2019-01-31 14:19:16 回复 2019-01-31 14:19

        woc,ajax 评论有问题,先禁用了

        1. 叶奕

          叶奕


          Warning: unpack(): Type V: not enough input, need 4, have 1 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 473

          Warning: unpack(): Type V: not enough input, need 4, have 0 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 158

          Warning: unpack(): Type V: not enough input, need 4, have 1 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 473

          Warning: unpack(): Type V: not enough input, need 4, have 0 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 158
            
          2019-01-31 15:11:20 回复 2019-01-31 15:11

          【摊手

昵称
邮箱
网站
 
Warning: unpack(): Type V: not enough input, need 4, have 1 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 473

Warning: unpack(): Type V: not enough input, need 4, have 0 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 158

Warning: unpack(): Type V: not enough input, need 4, have 1 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 473

Warning: unpack(): Type V: not enough input, need 4, have 0 in /srv/www/lantian.pub/usr/themes/lantian/vendor/itbdw/ip-database/src/IpLocation.php on line 158