Skip to content

View and manage the outbound mail queue

The postfix mail queue contains all emails your server has not yet delivered to their destination mail servers.

All commands related to the mail queue must be run while SSH’d into your server as root.

List emails in the queue

To list all emails in the mail queue, use the command:

Terminal window
sudo postqueue -p

Each email listed will have a unique identifier such as BA3DC120D88.

View contents of a queued email

To view the contents of an email in the queue, use the following command. Replace MESSAGE_ID with the email’s identifier shown in the output of sudo postqueue -p (see above).

Terminal window
sudo postcat -q MESSAGE_ID

For example, to view a message that has the identifier BA3DC120D88:

Terminal window
sudo postcat -q BA3DC120D88

Delete all emails from the queue

To permanently delete all mail from your server’s mail queue, use the command:

Terminal window
sudo postsuper -d ALL