Extracting Hard Bounce Email Addresses from Postfix Mail Logs with a One-liner
2022-07-20 04:10 (4 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
Related posts
Parsing Claude Code stream-json output with jq — extract .event.delta.text in real time
Analyzing Apache Access Logs with GoAccess Instead of Webalizer or Analog
After Upgrading to Django 5 and Updating Dependencies, SSL: CERTIFICATE_VERIFY_FAILED Error Occurs When Sending Emails
Sending email from EmDash with Brevo
Please rate this article (No signup or login required)
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.