Postfix: Email queue management, most common management commands Print

  • 2


Managing the Mail Queue with Postfix

Check the current SMTP mail queue

postqueue -p

Displays the errors and size of the current queue.

 

Delete the entire mail queue

postsuper -d ALL

 

Delete only deferred (retrying) emails

postsuper -d ALL deferred

 

Force processing of the mail queue

postqueue -f

 

Delete queued emails from a specific domain

postqueue -p | tail -n +2 | awk 'BEGIN { RS = "" } /username@example\.com/ { print $1 }' | tr -d '*!' | postsuper -d -

Replace username@example.com with the desired address or domain.

 

Analyze deferred messages

  • qshape deferred | head – Shows messages by recipient domain
  • qshape -s deferred | head – Shows messages by sender address

 

Log monitoring

  • tail -n 100 /var/log/mail.log – View the last 100 lines
  • tail -f /var/log/mail.log – Monitor the mail log in real time
  • grep tom@domain.com /var/log/mail.log – Search for a specific address

 

Postfix service control

  • postfix stop – Stop Postfix
  • postfix start – Start Postfix

 

Postfix configuration

  • postconf -n – Show active configuration parameters
  • /etc/postfix/main.cf – Main configuration file

 

Mail queue storage path

/var/spool/postfix

 


Was this answer helpful?

« Back