:::: MENU ::::

Remove list of mail addresses from postfix queue

  • May 15 / 2017
  • 0
Linux

Remove list of mail addresses from postfix queue

There is no easy way to remove a list of mails in queue with a same sender or domain in Postfix. But you can use some standard commands to get this working.

First check the list of mails you want to remove with something like

postqueue -p |grep -e '[email protected]|[email protected]|[email protected]' -B2 |grep "^[A-Z0-9]"

You’re getting the list of mails that you will remove with the sender

FC0177DF1A0     8373 Thu May  6 11:24:56  [email protected]
F179A2C68AB     9469 Sun May  7 03:21:41  [email protected]
EAE217FB850    11049 Sat May  8 04:20:32  [email protected]

And now you can remove those mails from the queue by using postsuper -d

postqueue -p |grep -e '[email protected]|[email protected]|[email protected]' -B2 |grep "^[A-Z0-9]{10}" |cut -d" " -f1 |postsuper -d -

You will see the mails being removed

postsuper: FC0177DF1A0: removed
postsuper: F179A2C68AB: removed
postsuper: EAE217FB850: removed
postsuper: Deleted: 3 messages

Comments are closed.

Question ? Contact