John Clark: > I've been tasked with catching several bounce-back conditions (no longer > subscriber, connection refused, host not found, email address invalid, etc) > and adding the offending email address from our email server's messaging > list to prevent poisoning our mailserver's IP per several ISPs rules. > > Messages in my deferral queue are set to be removed after 5 days and I have > been instructed to catch the above stated conditions after 3 days to > auto-opt-out. > > I have a kludgy method for doing this but I don't believe it's an ideal > solution. Is there anything built in to Postfix to automate this process > better?
Postfix sends a bounce message when a message expires in the queue. That bounce message is in standardized form, as described in RFC 3462. See for example, http://tools.ietf.org/html/rfc3462 > Currently I am iterating through messages from `postqueue -p` with grep and > awk to parse out emails that match the conditions specified and log the > timestamp and the offending email address. I am then looping though the > generated hashmap to run a SQL insert on email addresses that have been in > the queue for more than 3 days. This is too much work. Parse the RFC 3462 message instead. It is meant to be machine-readble. Wietse