↑ ↓ select, Enter open, Esc close

Delete all mail from one sender in the Postfix queue

Adjust the values, the command updates live
root@server
postqueue -p | awk -v s="info@example.com" '/^[0-9A-Za-z]/ && $7 == s {print $1}' | tr -d '*!' | postsuper -d -

Finds all messages in the queue with the given sender address and passes their queue IDs to postsuper -d. Useful after a single account was abused, when legitimate mail from other senders should stay in the queue.

Note: The address must be written exactly as it appears in postqueue -p. Run the part before | postsuper on its own first and check the IDs.

Also searched as

  • remove spam from one mailbox from queue
  • postfix delete emails from sender
  • delete mail from hacked account

Related one-liners

All in Mail

Read first, then run.

The commands on myline.de act directly on servers, files and databases. A wrong path or placeholder can delete data irreversibly or make a server unreachable.

  • All commands are provided without warranty and are not tested on every system.
  • Understand what a command does before running it, and check every placeholder.
  • Make a backup first and, if possible, try it on a test system.
  • You run commands at your own risk. Liability for damages is excluded to the extent permitted by law.