之前一直以为是 mandrill 跑路的锅,今天翻了下服务器上的日志,发现一大堆这种报错:
May 03 13:09:03 suse postfix/smtp[6310]: connect to mx3.qq.com[2001:df6:f400::2808]:25: Network is unreachable
May 03 13:09:33 suse postfix/smtp[6306]: connect to gmail-smtp-in.l.google.com[64.233.189.27]:25: Connection timed out
May 03 13:09:33 suse postfix/smtp[6307]: connect to gmail-smtp-in.l.google.com[64.233.189.27]:25: Connection timed out
May 03 13:09:33 suse postfix/smtp[6308]: connect to mx2.hotmail.com[65.54.188.94]:25: Connection timed out
May 03 13:09:33 suse postfix/smtp[6309]: connect to mx3.qq.com[184.105.206.31]:25: Connection timed out
May 03 13:09:33 suse postfix/smtp[6310]: connect to mx3.qq.com[184.105.206.32]:25: Connection timed out
May 03 13:09:34 suse postfix/smtp[6305]: connect to aspmx.l.google.com[173.194.72.27]:25: Connection timed out
May 03 13:10:03 suse postfix/smtp[6306]: connect to alt1.gmail-smtp-in.l.google.com[74.125.25.27]:25: Connection timed out
May 03 13:10:03 suse postfix/smtp[6307]: connect to alt1.gmail-smtp-in.l.google.com[74.125.25.27]:25: Connection timed out
May 03 13:10:03 suse postfix/smtp[6308]: connect to mx2.hotmail.com[65.55.33.119]:25: Connection timed out
May 03 13:10:03 suse postfix/smtp[6309]: connect to mx3.qq.com[203.205.160.43]:25: Connection timed out
May 03 13:10:03 suse postfix/smtp[6310]: connect to mx3.qq.com[184.105.206.86]:25: Connection timed out
May 03 13:10:04 suse postfix/smtp[6305]: connect to alt1.aspmx.l.google.com[74.125.25.26]:25: Connection timed out
May 03 13:10:33 suse postfix/smtp[6306]: connect to alt2.gmail-smtp-in.l.google.com[74.125.194.26]:25: Connection timed out
May 03 13:10:33 suse postfix/smtp[6307]: connect to alt2.gmail-smtp-in.l.google.com[74.125.194.26]:25: Connection timed out
May 03 13:10:33 suse postfix/smtp[6308]: connect to mx1.hotmail.com[65.55.33.135]:25: Connection timed out
May 03 13:10:33 suse postfix/smtp[6310]: connect to mx3.qq.com[184.105.206.82]:25: Connection timed out
May 03 13:10:33 suse postfix/smtp[6309]: connect to mx3.qq.com[184.105.206.82]:25: Connection timed out
May 03 13:10:34 suse postfix/smtp[6305]: connect to alt2.aspmx.l.google.com[74.125.193.26]:25: Connection timed out
May 03 13:11:03 suse postfix/smtp[6306]: connect to alt3.gmail-smtp-in.l.google.com[74.125.193.26]:25: Connection timed out
May 03 13:11:03 suse postfix/smtp[6307]: connect to alt3.gmail-smtp-in.l.google.com[74.125.193.26]:25: Connection timed out
May 03 13:11:03 suse postfix/smtp[6308]: connect to mx1.hotmail.com[65.55.92.152]:25: Connection timed out
May 03 13:11:03 suse postfix/smtp[6310]: connect to mx3.qq.com[184.105.206.85]:25: Connection timed out
May 03 13:11:03 suse postfix/smtp[6309]: connect to mx3.qq.com[184.105.206.85]:25: Connection timed out
iptables 里面没有封 25 端口,估计是服务商做的限制,不过总之,问题算是找到了
解法很简单,既然是 postfix 发不出去,配置 postfix 使用第三方的邮件递送服务就行了,关键词:postfix smtp relay
我基本上是照着这篇文章做的: community.rackspace.com/products/f/28/t/3897
在 SparkPost 的帮助里面也有一个: support.sparkpost.com/customer/en/portal/articles/2030960-using-sparkpost-with-postfix
本来是打算用 SparkPost 来着因为某卷推荐,结果配上之后发信报错:
550 5.7.1 Unconfigured Sending Domain <opensuse.org>
根据文档说明,这是因为发信域名不在账户的已验证域名列表中,而验证需要修改域名 DNS 记录我并没有操作域名的权限,所以换成了用 Mailgun.
Mailgun 是验证了域名之后,从这个帐号发出去的邮件都会由已验证的域名代发,所以没有这个问题
服务器上的队列里面积压了几十封之前没发成功的邮件,会陆续投递出去,所以可能会有一些人邮箱被刷…
如果有新注册用户没有收到激活信息的,可以在登录页面尝试重新发送;如果还发现有问题请联系我(签名里面有邮箱)