How to verify if an email was successfully sent by postfix

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=<user@domain.com>, size=1372, nrcpt=1 (queue active)
Sep 14 06:27:10 mailhost postfix/qmgr[21603]: 11673C5FDA: from=<user@domain.com>, size=1469, nrcpt=1 (queue active)

This information is completely invaluable. By this all I see is that user@domain.com 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

Best Answer

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=<localuser@local.domain>, 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.

Related Topic