With Postfix version 2.1 and later you can ask Postfix to
produce mail delivery reports for debugging purposes. These reports
not only show sender/recipient addresses after address rewriting
and alias expansion or forwarding, they also show information about
delivery to mailbox, delivery to non-Postfix command, responses
from remote SMTP servers, and so on.
Postfix can produce two types of mail delivery reports for
debugging:
-
What-if: report what would happen, but do not actually
deliver mail. This mode of operation is requested with:
$ /usr/sbin/sendmail -bv address...
Mail Delivery Status Report will be mailed to <your login name>.
-
What happened: deliver mail and report successes and/or
failures, including replies from remote SMTP servers. This mode
of operation is requested with:
$ /usr/sbin/sendmail -v address...
Mail Delivery Status Report will be mailed to <your login name>.
These reports contain information that is generated by Postfix
delivery agents. Since these run as daemon processes and do not
interact with users directly, the result is sent as mail to the
sender of the test message. The format of these reports is practically
identical to that of ordinary non-delivery notifications.
As an example, below is the delivery report that is produced
with the command "sendmail -bv [email protected]". The
first part of the report contains human-readable text. In this
case, mail would be delivered via mail.cloud9.net, and the SMTP
server replies with "250 Ok". Other reports may show delivery
to mailbox, or delivery to non-Postfix command.
Content-Description: Notification
Content-Type: text/plain
This is the Postfix program at host spike.porcupine.org.
Enclosed is the mail delivery report that you requested.
The Postfix program
<[email protected]>: delivery via mail.cloud9.net[168.100.1.4]: 250 Ok
The second part of the report is in machine-readable form, and
includes the following information:
- The envelope sender address ([email protected]).
- The envelope recipient address ([email protected]).
If the recipient address was changed by Postfix then Postfix also
includes the original recipient address.
- The delivery status.
Some details depend on Postfix version. The example below is
for Postfix version 2.3 and later.
Content-Description: Delivery report
Content-Type: message/delivery-status
Reporting-MTA: dns; spike.porcupine.org
X-Postfix-Queue-ID: 84863BC0E5
X-Postfix-Sender: rfc822; [email protected]
Arrival-Date: Tue, 13 Apr 2004 19:27:43 -0400 (EDT)
Final-Recipient: rfc822; [email protected]
Action: deliverable
Status: 2.0.0
Remote-MTA: dns; mail.cloud9.net
Diagnostic-Code: smtp; 250 Ok
The third part of the report contains the message that Postfix
would have delivered, including From: and To: message headers, so
that you can see any effects of address rewriting on those. Mail
submitted with "sendmail -bv" has no body content so none is shown
in the example below.
Content-Description: Message
Content-Type: message/rfc822
Received: by spike.porcupine.org (Postfix, from userid 1001)
id 84863BC0E5; Tue, 13 Apr 2004 19:27:43 -0400 (EDT)
Subject: probe
To: [email protected]
Message-Id: <[email protected]>
Date: Tue, 13 Apr 2004 19:27:43 -0400 (EDT)
From: [email protected] (Wietse Venema)