In this article, we will discuss some basic commands that will help you manage the Postfix mail queue, so you can check how many emails are queued, delete them, …
The first step is to connect via SSH to your server so you can run the following commands:
Additional Information
You can find more information about accessing your server via SSH in the article:
-
This first command will show you all the messages in the mail queue, but without detailed information:
mailq -
If you have used the mailq command and copy an email's ID, you can view its contents with the following command:
postcat -q ID -
The following command completely deletes the entire mail queue that exists when you run it:
postsuper -d ALL -
To delete all messages that have been returned by recipients for any reason, you can use the command:
postsuper -d ALL deferred -
Finally, the following command will show you, as a number, how many messages are currently in the queue:
postqueue -p | tail -n 1 | cut -d' ' -f5