Extracting Hard Bounce Email Addresses from Postfix Mail Logs with a One-liner
2022-07-20 04:10 (3 years ago)

A one-liner to extract email addresses that failed to send (hard bounced) from Postfix logs.
You need to stop sending emails to the email addresses that hard bounced.
grep "said: 550 " /var/log/mail.log | sed -r 's/^.*to=<([^>]+)>.*$/\1/' | uniq > /tmp/hard-bounced-emails.txt
Please rate this article
Currently unrated
The author runs the application development company Cyberneura.
We look forward to discussing your development needs.
We look forward to discussing your development needs.