最近發現從
主機每天自動備份完成的通知信被gmail退了,錯誤訊息大致如下:
host gmail-smtp-in.l.google.com[209.85.147.27] said:
550-5.7.1 [220.135.57.87] The IP you're using to send email is not
authorized 550-5.7.1 to send email directly to our servers. Please use
550 5.7.1 the SMTP relay at your service provider instead. j21si8542316wah
(in reply to end of DATA command)
由於之前postfix都還運作得好好的,故很難想出問題出在那裡,在Google找了一陣子,終於找到了一篇
轉換到 Google Apps, localhost 信寄不出去的解法,裡面提到修改/etc/postfix/mail.cf,把postfix預設的順序調整一下,例如原來我的設定是:
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain,
mail.$mydomain, www.$mydomain
將它調整為localhost排最前面即可:
mydestination = localhost, localhost.$mydomain, $myhostname, $mydomain,
mail.$mydomain, www.$mydomain
設定完成之後用
postfix check
指令檢查一下
然後重新啟動
service postfix restart
再發信測試看看,哈!gmail可以收到信了!
參考資料:
Tsung's Blog: 轉換到 Google Apps, localhost 信寄不出去的解法
鳥哥的 Linux 與 ADSL 私房菜: 簡易 Mail Server 架設 -- Postfix 設定