Linode 於 2019/12/5 以後開得新帳號(原因:CAN-SPAM Act),連到外部 SMTP Port 預設都被擋掉,以至於全部 Connection timed out。
新開機器可以直接 telnet 測試看看:
$ telnet gmail-smtp-in.l.google.com 25 Trying 2404:6800:4008:c03::1b… Trying 74.125.203.26… telnet: Unable to connect to remote host: Connection timed out
正常狀況
$ telnet gmail-smtp-in.l.google.com 25 Trying 74.125.203.26… Connected to gmail-smtp-in.l.google.com. Escape character is '^]'. 220 mx.google.com ESMTP k2si12268129pld.364 - gsmtp
於 Postfix 的 /var/log/mail.log 會看到下述訊息:
Apr 29 12:47:24 localhost postfix/smtp[18520]: connect to gmail-smtp-in.l.google.com[74.125.203.27]:25: Connection timed out Apr 29 12:47:24 localhost postfix/smtp[18521]: connect to gmail-smtp-in.l.google.com[108.177.97.27]:25: Connection timed out
Apr 29 12:47:24 localhost postfix/smtp[18523]: connect to gmail-smtp-in.l.google.com[64.233.189.26]:25: Connection timed out
Apr 29 12:47:54 localhost postfix/smtp[18523]: connect to alt1.gmail-smtp-in.l.google.com[108.177.9.27]:25: Connection timed out
Apr 29 12:48:24 localhost postfix/smtp[18523]: connect to alt2.gmail-smtp-in.l.google.com[209.85.234.26]:25: Connection timed out
Apr 29 12:48:54 localhost postfix/smtp[18522]: connect to alt3.gmail-smtp-in.l.google.com[142.250.11.27]:25: Connection timed out Apr 29 12:49:24 localhost postfix/smtp[18520]: connect to alt4.gmail-smtp-in.l.google.com[142.250.12.27]:25: Connection timed out
想要開通 Email 的 SMTP Port 需要做些設定,然後在於後台開 Ticket 申請。
Linode Email 無法寄送的解法
此問題解法只能開 Ticket 給 Linode,然後 Linode 會需要做幾個設定:
- a valid DNS A record
- rDNS for any Linodes that you plan to use to send email.
- Our guides on configuring DNS and rDNS records within the Linode Manager are linked below:
- Next, we ask that you provide us with the name(s) of the Linode(s) that you will be using for mailing.
- Finally, we recommend you review Section 2 ("Abuse") of our Acceptable Use Policy. Terms of Service or AUP violations may result in the reinstatement of SMTP port restriction.
所以設定下述:
- A (ipv4) / AAAA (ipv6) / Wildcard () Domain 設定到 Linode 的 IP
- 設定反解,在 Linode 的機器
設定完成後,驗證:
- dig +short $DOMAIN # check A record
- dig -x $IP +short # check rDNS 反解
設定完成後,再回覆 Ticket 即可