大网数据广告活动
服务器运维问答

How to retrieve non-delivered postfix emails?

· 52CE 我爱测

I recently discovered that all emails that were meant to be being sent to a particular address of mine via postfix on my Ubuntu server have been getting rejected by the 3rd party email provider. So there is about 6 months of emai…

问题原文

原帖链接 · Matt · CC BY-SA 4.0

I recently discovered that all emails that were meant to be being sent to a particular address of mine via postfix on my Ubuntu server have been getting rejected by the 3rd party email provider.

So there is about 6 months of emails I have not received (the emails were from a submission form on my website).

I have checked and postfix mail queue is empty.

This is a sample log entry when an email was non-delivered (xxx's for privacy).

Nov 14 21:17:51 ip-xxx-xxx-xxx-xxx postfix/smtp[2932654]: D6F393EA37: to=<[email omitted]>, relay=mx2.privateemail.com[198.54.122.215]:25, delay=12, delays=0.02/0.01/7.2/5.1, dsn=5.1.8, status=bounced (host mx2.privateemail.com[198.54.122.215] said: 554 5.1.8 <[email omitted]>: Sender address rejected: Domain not found (in reply to RCPT TO command))
Nov 14 21:17:51 ip-xxx-xxx-xxx-xxx postfix/cleanup[2932652]: 44F5E3EA38: message-id=<[email omitted]>
Nov 14 21:17:51 ip-xxx-xxx-xxx-xxx postfix/bounce[2932655]: D6F393EA37: sender non-delivery notification: 44F5E3EA38
Nov 14 21:17:51 ip-xxx-xxx-xxx-xxx postfix/qmgr[4079]: 44F5E3EA38: from=<>, size=3166, nrcpt=1 (queue active)
Nov 14 21:17:51 ip-xxx-xxx-xxx-xxx postfix/qmgr[4079]: D6F393EA37: removed
Nov 14 21:17:51 ip-xxx-xxx-xxx-xxx postfix/local[2932656]: 44F5E3EA38: to=<[email omitted]>, relay=local, delay=0.01, delays=0.01/0/0/0, dsn=2.0.0, status=sent (delivered to mailbox)
Nov 14 21:17:51 ip-xxx-xxx-xxx-xxx postfix/qmgr[4079]: 44F5E3EA38: removed

Is there any way to retrieve the non-delivered emails over the last 6 months?

已采纳解答

原帖链接 · Nikita Kipriyanov · CC BY-SA 4.0

In principle, if you have something in the queue, you may find a list of such mail via

postqueue -p

which tells you IDs. Then, for each ID, you may print a complete body of that email with

postcat -q <ID>

And if you decide to delete a message,

postsuper -d <ID>

However, in your case you have nothing in the queue, so nowhere you can get the mail, unless it was saved somewhere before it was given to Postfix.

Your mail was rejected with 554 code. 5xx codes mean non-recoverable error. This kind of error makes Postfix think the mail is not worth keeping, because it could not be delivered in any subsequent attempts. By the way, the "domain not found" should not be "non-recoverable" (because it could be the problem with the DNS on the receiver side), but in this case you seem to have "private" DNS name, which could justify the hard fail.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2021-11-14)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。