Postfix commands
List all emails - you can list all mail of queue, using one of the following commands:
<strong>postqueue -p</strong>
Flush all emails - To delete or flush all emails from Postfix mail queue using the following command:
<strong>postsuper -d ALL </strong>
Flush deferred mails only - use the following command to delete deferred emails from the queue.
<strong>postsuper -d ALL deferred </strong>
Remove specific email - in case you want to remove any specific email, you can use the following command:
First search the ID of that email like below command
<strong>postqueue -p | grep "email@example.com"</strong>
0AB345F3D24* 5513 Sun Feb 26 02:26:27 email@example.com
Delete mail from mail queue with id 0AB345F3D24.
<strong>postsuper -d 0AB345F3D24 </strong>
To count messages in queue you can use something like:
<strong>postqueue -p | grep -c "^[A-Z0-9]" </strong>
To process messages in queue you can use:
<strong>postqueue -f </strong>
To save the message in file you can use:
<strong>postcat -vq messageid > message.txt </strong>
You can view a particular message using:
<strong>postcat -vq messageid</strong>
