Mail Servers

Useful Postfix commands Linux

postfix commands
postfix commands

Useful Postfix commands

This post lists some useful Postfix commands which will help you to troubleshoot Postfix email issues. Please check the Postfix commands below.

View the postfix version

 
postconf mail_version

Mail queue:

 
mailq

To get the number of emails in the queue:

 
mailq | wc -l

To list mail queue with Email IDs

 
postqueue -p

To process the queue:

 
postqueue -f

To remove all mail from the queue :

 
postsuper -d ALL

To remove all mails in the deferred queue :

 
postsuper -d ALL deferred

To remove specific mail from queue:

 
postsuper -d MAIL_ID

To view the mail content :

 
postcat -q MAIL_ID

To sort queued mails:

 
mailq | awk '/^[0-9,A-F]/ {print $7}' | sort | uniq -c | sort -n

To remove all mails sent by xyz@domain.com from the queue:

 
mailq| grep '^[A-Z0-9]'| grep xyz@domain.com |cut -f1 -d' ' |tr -d \*|postsuper -d -

To suspend all deliveries of emails in the queue:

 
postsuper -h ALL

To unsuspend the deliveries of emails in the queue:

 
postsuper -H ALL

To restart Posfix

 
postfix reload

Check the postfix installation:

 
postfix check

To show default postfix values:

 
postconf -d

To show non default postfix values:

 
postconf -n

To see the mails in a tree structure:

 
qshape

That’s it!

If you like this post and wish to receive more articles from us, please like our FB page: Grepitout

Your suggestions and feedbacks will encourage us and help to improve further, please feel free to write your comments.

For more details on our services, please drop us an E-mail at info@grepitout.com

Topics