Postfix

From Lolly's Wiki
Revision as of 08:55, 4 March 2022 by Lollypop (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

First of all: Postfix is a unwanted fuck in the administrators ass from hell. Use Exim. If you are a poor admin and can not do this, here is a minimal set of commands.

Display queue

root@mail:~# postqueue -p

Display mail content from a mail in the queue

root@mail:~# postcat -vq  4K8PQr0VlYz2xV1

Delete a mail from the queue

root@mail:~# postsuper -d 4K8PQr0VlYz2xV1

Search and delete a set of mails from the queue

To delete all mails in queue for a recipient that matches 'hello@':

root@mail:~# postqueue -p | awk -v search='hello@' '/^[0-9a-zA-Z]/{qid=$1; next;} $0 ~ search {print qid;}' | postsuper -d -
postsuper: 4K7xpC29QDz2xTW: removed
postsuper: 4K7zpF2D0Wz2xTZ: removed
postsuper: 4K7wST3jD5z2xTQ: removed
postsuper: 4K7lpn5dtHz2xH2: removed
postsuper: 4K7mFh1ds5z2xJp: removed
postsuper: 4K8MP352Clz2xTq: removed
postsuper: Deleted: 6 messages