Email

郵件遞送通知已正確遞送,實際郵件未正確遞送

  • January 17, 2019

我已將我們部門的 Debian 工作站配置為使用 Exim 4 進行郵件傳遞。我還創建了一個別名,以便我收到所有root電子郵件。Exim 4 配置(通過 Ansible 和 debconf)具有以下設置:

exim4_dc_eximconfig_configtype: internet
exim4_dc_readhost: …
exim4_dc_smarthost: …
exim4_dc_use_split_config: 'true'
exim4_dc_hide_mailname: 'true'
exim4_dc_mailname_in_oh: 'true'

在每台機器上,我都可以mailx用來發送電子郵件root,它會很好地顯示在我的收件箱中。一些cron 作業的執行也被正確地發送給我。

但是,大多數 cron 作業都無法發送電子郵件,而是收到以下電子郵件:

This message was created automatically by mail delivery software.

A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:

 ueding@…
   (generated from root@echo)



Reporting-MTA: dns; echo

Action: failed
Final-Recipient: rfc822;ueding@…
Status: 5.0.0



Return-path: <root@echo>
Received: from root by echo with local (Exim 4.89)
   (envelope-from <root@echo>)
   id 1f7Jqz-0007jU-7y
   for root@echo; Sat, 14 Apr 2018 14:00:25 +0200
From: root@echo (Cron Daemon)
To: root@echo
Subject: Cron <root@echo> ansible-pull -U git@github.com:…/….git --private-key /root/.ssh/ansible_pull localhost.yml
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 8bit
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=root>
Message-Id: <E1f7Jqz-0007jU-7y@echo>
Date: Sat, 14 Apr 2018 14:00:25 +0200
X-Exim-DSN-Information: Due to administrative limits only headers are returned

我真的不明白為什麼會這樣。要麼所有電子郵件傳遞都失敗,要麼幾乎全部成功。來自 cron 的電子郵件如何在大多數工作站上失敗但在其他工作站上成功,而傳遞失敗的電子郵件總是通過?


機器上有關 exim 的系統日誌 echo 非常稀疏:

# journalctl -u exim4.service 
-- Logs begin at Tue 2018-03-06 18:35:11 CET, end at Sat 2018-04-14 17:13:08 CEST. --
Apr 02 18:00:30 echo systemd[1]: Starting LSB: exim Mail Transport Agent...
Apr 02 18:01:23 echo exim4[27433]: Starting MTA: exim4.
Apr 02 18:01:23 echo systemd[1]: Started LSB: exim Mail Transport Agent.

調查在一個銀盤/var/log/exim4/mainlog上提供解釋:

2018-04-14 14:00:25 1f7Jqz-0007jU-7y <= root@echo U=root P=local S=7948
2018-04-14 14:00:25 1f7Jqz-0007jU-7y ** ueding@… <root@echo> R=dnslookup T=remote_smtp: message is too big (transport limit = 1)
2018-04-14 14:00:25 1f7Jqz-0007jW-BM <= <> R=1f7Jqz-0007jU-7y U=Debian-exim P=local S=1856
2018-04-14 14:00:25 1f7Jqz-0007jU-7y Completed
2018-04-14 14:00:26 1f7Jqz-0007jW-BM => ueding@… <root@echo> R=dnslookup T=remote_smtp H=… […] X=TLS1.0:RSA_AES_256_CBC_SHA1:256 CV=yes DN="C=DE,ST=…,L=…,O=…,OU=…,CN=…" C="250 2.0.0 Ok: queued as 6FCA1155FC32"
2018-04-14 14:00:26 1f7Jqz-0007jW-BM Completed

錯誤可能是“消息太大(傳輸限制 = 1)”。但這仍然沒有多大意義,因為我有 30 個相同配置的工作站,其中一些工作站的消息連續幾天通過。每台機器的消息長度應該相同(主機名的長度除外),並且目前接收電子郵件的兩台機器具有更長的名稱。

我認為您已經遇到了這個報告的錯誤exim4: bogus reject response on overlong lines

它實際上是指太長的行,而不是消息本身。在將消息fmt -s傳遞給exim4.

日誌中的範例:

email@domain.tld R=smarthost T=remote_smtp_smarthost:消息太大(傳輸限制= 1)

這意味著已達到 998 個字元的最大 LINE 限制

解決方案:

在“/etc/exim4/exim4.conf.localmacros”中添加以下行:

IGNORE_SMTP_LINE_LENGTH_LIMIT = 1

然後重新啟動 exim4。

引用自:https://unix.stackexchange.com/questions/437761