I want to run a program when postfix has successfully sent out a mail (local or remote).
I would like to pass the headers to program and if possible also the destination ip or address (exclude spam filter delivery).
I just have an idea: Delivery Status Notification processing via uniqe transport program, but I'd prefer the above.
My goal is to be recorded lifetime (events) of email: it came, it went out (from, to, subject, datetime, message id, message status: bounce, sent). I would only need the state of the outgoing mail, because incoming and bounce program is working.
It is possible to trigger a program (similar to a transport pipe/spawn) or DSN "cheat" stay?
Thanks in advance for any reply!
Best Answer
This is only for logging message headers.
By default postix already logs most of this information, though not in one line. It doesn't, however, log the subject or message-id. We can add that in by using
header_checks 5
.Note: for all mail and not just outgoing, use
header_checks
instead ofsmtp_header_checks
.These messages will be logged to syslog in the facility specified by
syslog_facility
(default: mail)
.