Monitor Postfix outgoing mail delivery

I'm using GNU Mailman with Postfix to run a mailing list, and would like to monitor the delivery of outgoing mail, that is: for each mail sent from the list, check whether a 250 (OK) message was answered, and if not, report back to me.

For now, I'm doing a quick-and-dirty:

# cat /var/log/syslog | grep "smtp.*to=.*" | grep -v 250

Is there a clean way to monitor smtpd's output?


There is no way to monitor the sent mails in a clean way. You can only grep the details from the maillog of postfix.

Here is an example:

log='logfile of postfix'
grep "status=sent" $log | \
egrep -ve 'postfix/(cleanup|pickup|master|qmgr|smtpd|local|pipe)'

And also avoid the logs for dkim etc. If you need the count of mails then pipe on wc -l at the end.


How about:

multitail -eX "smtp.*to=<(.*)>.*sent.*250" './bin/received' -f /var/log/maillog

./bin/received is a shell script that gets the destination email address as a parameter and does something with it.


try this

cat /var/log/maillog |grep -v "relay=local" |grep "relay=" |grep "status=sent"

you will find very helpful info here http://en.redinskala.com/postfix-maillog-interpretation/