Extracting Hard Bounce Email Addresses from Postfix Mail Logs with a One-liner

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

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

Categories

Archive