aboutsummaryrefslogtreecommitdiff
path: root/content/blog/miscellaneous/purge-postfix-queue-based-content.md
blob: 3800b07c80473ecb8325712f9a9a853c44ace493 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
---
title: "Purge postfix queue based on email contents"
date: 2009-04-27
description: How to selectively purge a postfix queue based on email contents
tags:
  - toolbox
---

## The problem

Sometimes a lot of spam can acacumulate in a postfix queue.

## The solution

Here is a command that can search through queued emails for a certain character string (here XXX as an example) and delete the ones that contain it :
```sh
find /var/spool/postfix/deferred/ -type f -exec grep -li 'XXX' '{}' \; | xargs -n1 basename | xargs -n1 postsuper -d
```