How to verify if an email was successfully sent by postfix?
I get asked day by day to verify if a mail was successfully sent out by our server (because client complains that he sent it to xy and his recipient never got it). Most likely this isn't our fault but the recipients mail server dropped/flagged the mail as spam. So my question is how to verify (if it's possible) that a mail was SENT OUT by postfix from our end?
If I grepping through the mail.log.* files I get entries like:
Sep 14 06:27:10 mailhost postfix/qmgr[21603]: 14B40C65A1: from=<[email protected]>, size=1372, nrcpt=1 (queue active)
Sep 14 06:27:10 mailhost postfix/qmgr[21603]: 11673C5FDA: from=<[email protected]>, size=1469, nrcpt=1 (queue active)
This information is completely invaluable. By this all I see is that [email protected] sent an email at 6:27 to somebody and it was queued by the mail system (not that it was sent out and what happend after).
Is it possible to log these events with postfix? Even if it takes increasing the error log I need this information.
Thanks
Solution 1:
By default, Postfix creates at least two log lines for a piece of outgoing mail it handles: For the receiving and the sending part.
Sep 15 10:30:51 mail postfix/qmgr[1499]: F1FBEC0666: from=<[email protected]>, size=251, nrcpt=1 (queue active)
Sep 15 10:30:51 mail postfix/smtp[25011]: F1FBEC0666: to=<remoteuser@remotedomain>, relay=xxxxxx[yyyyyyy]:25, delay=0.83, delays=0.15/0.01/0.27/0.39, dsn=2.0.0, status=sent (250 Requested mail action okay, completed: id=xxxxxxxxxxx)
Sep 15 10:30:51 mail postfix/qmgr[1499]: F1FBEC0666: removed
My guess is that you grepped for the local user, not the remote user, and therefore didn't see the second line. Please don't use grep
if you don't really know what you are looking for, more
or less
is more useful there.
Solution 2:
Your mail user can also request a so-called Delivery Status Notification in his MUA. It's a kind of a Bounce-message, except that the included message includes a success message, like this example:
Your message was successfully delivered to the destination(s)
listed below. If the message was delivered to mailbox you will
receive no further notifications. Otherwise you may still receive
notifications of mail delivery errors from other systems.
The mail system
<[email protected]>: delivery via mx.example.org[199.4.28.26]:25: 250
Requested mail action okay, completed: id=2LMKVd-1Y2eA52oJa-70aFI9
The report also includes detailed information of when did the message arrive at which server.
In Thunderbird a DSN-request can be activated in the compose-window as follows: Options > Delivery Status Notification.