Removing messages from a postfix queue based on message body content
I would like to delete some messages from an existing postfix queue based on a string match in the message body. Any suggestions?
This is fairly simple:
find /var/spool/postfix/deferred/ -type f \
-exec grep -l 'body string here' '{}' \; | \
xargs -n1 basename | xargs -n1 postsuper -d
Adjust path (if non-default), and the -n1 in the second xargs isn't strictly needed, but gives a better sense that it's actually doing something.
Perhaps you should end that with > delfile.txt then you can review what you deleted and then delete the text file