---
slug: "grep-hard-bounced-emails-from-postfix-log"
title: "Extracting Hard Bounce Email Addresses from Postfix Mail Logs with a One-liner"
description: "Extracting email addresses that have hard bounced from Postfix logs using a one-liner.\nEmail sending must be stopped for addresses that have hard bounced."
url: "https://www.ytyng.com/en/blog/grep-hard-bounced-emails-from-postfix-log"
publish_date: "2022-07-20T04:10:39Z"
created: "2022-07-20T04:10:39Z"
updated: "2026-02-26T16:20:25.801Z"
categories: []
keywords: ""
featured_image_url: "https://media.ytyng.com/resize/20230812/2077af7a9d614bf996f2a1d401f93f0e.png.webp?width=768"
has_video: false
has_music: false
video_urls: []
music_urls: []
lang: "en"
---

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

<p>A one-liner to extract email addresses that failed to send (hard bounced) from Postfix logs.<br />You need to stop sending emails to the email addresses that hard bounced.</p>
<pre>grep "said: 550 " /var/log/mail.log | sed -r 's/^.*to=&lt;([^&gt;]+)&gt;.*$/\1/' | uniq &gt; /tmp/hard-bounced-emails.txt</pre>
