Postfix: Difference between revisions

From Lolly's Wiki
Jump to navigationJump to search
No edit summary
No edit summary
 
Line 1: Line 1:
[[category:Mail]]
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.
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==
==Display queue==
<SyntaxHighlight>
<syntaxhighlight lang="bash">
root@mail:~# postqueue -p
root@mail:~# postqueue -p
</SyntaxHighlight>
</syntaxhighlight>


==Display mail content from a mail in the queue==
==Display mail content from a mail in the queue==
<SyntaxHighlight>
<syntaxhighlight lang="bash">
root@mail:~# postcat -vq  4K8PQr0VlYz2xV1
root@mail:~# postcat -vq  4K8PQr0VlYz2xV1
</SyntaxHighlight>
</syntaxhighlight>


==Delete a mail from the queue==
==Delete a mail from the queue==
<SyntaxHighlight>
<syntaxhighlight lang="bash">
root@mail:~# postsuper -d 4K8PQr0VlYz2xV1
root@mail:~# postsuper -d 4K8PQr0VlYz2xV1
</SyntaxHighlight>
</syntaxhighlight>


==Search and delete a set of  mails from the queue==
==Search and delete a set of  mails from the queue==
To delete all mails in queue for a recipient that matches 'hello@':
To delete all mails in queue for a recipient that matches 'hello@':
<SyntaxHighlight>
<syntaxhighlight lang="bash">
root@mail:~# postqueue -p | awk -v search='hello@' '/^[0-9a-zA-Z]/{qid=$1; next;} $0 ~ search {print qid;}' | postsuper -d -
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: 4K7xpC29QDz2xTW: removed
Line 27: Line 28:
postsuper: 4K8MP352Clz2xTq: removed
postsuper: 4K8MP352Clz2xTq: removed
postsuper: Deleted: 6 messages
postsuper: Deleted: 6 messages
</SyntaxHighlight>
</syntaxhighlight>

Latest revision as of 09:55, 4 March 2022

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