Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> 電腦軟體教學 >> 伺服器技術 >> 關於伺服器

Sendmail 554 錯誤「MX list points back to myself」一行配置修復

編輯:關於伺服器

在 Unix/Linux 環境下運行 Sendmail 時,若寄信出現:

----- Transcript of session follows -----
554 5.0.0 MX list for example.com. points back to example.com.
554 5.3.5 ... Local configuration error

即表示 Sendmail 認定自己是收件域名的最終 MX,卻又無法本地投遞,導致郵件迴路。根因通常是 /etc/mail/sendmail.cf 中 Cw (本地主機名稱清單) 缺少完整域名。

快速修復

  1. 編輯 /etc/mail/sendmail.cf(或 sendmail.mc 重建)
  2. 找到 Cwlocalhost 行
  3. 改為 Cwexample.com(您的實際郵件域名)
  4. 存檔

重啟 Sendmail 生效

/etc/init.d/sendmail stop && /etc/init.d/sendmail start/etc/rc.d/init.d/sendmail restartsystemctl restart sendmailservice sendmail restart
作業系統指令
Solaris 8/9/10
Linux (SysVinit)
Linux (systemd)
FreeBSD

原理說明

  • Cw 定義 Sendmail 認為「屬於本機」的主機名稱集合
  • 收信時,Sendmail 查詢收件域名 MX → 取得 mail.example.com → 解析 IP → 比對本機介面 IP
  • 若 IP 吻合但 Cw 無 example.com,Sendmail 認為「我是 MX 卻不認領此域」→ 拋 554 拒收
  • 補上 Cwexample.com 後,Sendmail 承認本地投遞責任,郵件進入 local mailer 投遞至 /var/mail 或 procmail

最佳實踐:改用 sendmail.mc 管理

# /etc/mail/sendmail.mc
define(`confDOMAIN_NAME', `example.com')dnl
FEATURE(`use_cw_file')dnl
# 實際主機名單寫在 /etc/mail/local-host-names
example.com
mail.example.com
localhost

修改 .mc 後:

cd /etc/mail
make   # 產生 sendmail.cf
systemctl restart sendmail

優點:集中管理、版本控制、避免手改 .cf 格式錯誤。

延伸檢查清單

  • host example.com 解析是否指向本機 IP?
  • /etc/hosts 是否有 127.0.0.1 example.com 干擾?
  • DNS MX 記錄是否正確指向 mail.example.com?
  • 防火牆 TCP 25 是否對外開放?
  • 檢查 /var/log/maillog 是否有其他 5xx 錯誤。
Copyright © Windows教程網 All Rights Reserved