Here I am discussing about the useful postfix commands that we use daily.

1. To see the status of the postfix mailqueue,

qshape

Eg :

root@test:~# qshape
                                         T  5 10 20 40 80 160 320 640 1280 1280+
                                  TOTAL  1  0  0  0  0  0   0   0   0    0     1
                              test1.com  1  0  0  0  0  0   0   0   0    0     1

2. To see the deferred mails for each domain,

qshape deferred

Eg:

root@ntest:~# qshape deferred
                                         T  5 10 20 40 80 160 320 640 1280 1280+
                                  TOTAL  9  0  0  0  0  0   0   0   0    0     9
                              test2.com  9  0  0  0  0  0   0   0   0    0     9

3. To see the entire mailqueue :
use the command

postqueue -p | more

or

mailq | more

4. To see the content of the message in the queue, use the below command with the corresponding QueueID

postcat -q ID

For verbose, you can use v as below :

postcat -qv ID

5. To send the email again, use :

postqueue -i ID

To see the log, use cat /var/log/mail.log | grep ID

6. To send all the mails forcefully, use :

postqueue -f

7. To delete one email :

postsuper -d ID

Eg :

root@nagiostest:~# postsuper -d 2139444F54
postsuper: 2139444F54: removed
postsuper: Deleted: 1 message

8. To remove all the deferred emails,

postsuper -d ALL deferred

Eg:

root@nagiostest:~# postsuper -d ALL deferred
postsuper: Deleted: 2 messages

Thanks 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s