How to delete mail queue in Postfix

From Brian Nelson Ramblings
Jump to: navigation, search

How to delete mail queue in Postfix

In this tutorial we will learn, how to delete mail queue in Postfix .

To clear the mail queue in Postfix, we will use the command called postsuper . Abbreviation of postsuper is Postfix superintendent . postsuper command can only be run by super user of the system eg. root .

Postsuper command is used for postfix mail queue related maintenance work.

To check the mail queue in system, we use mailq command .

mailq

It might be possible when you use mailq command,you may see long list of mails which are not delivered.

Most of the mails have deferred status . In this tutorial we will use postsuper command to delete/remove the mail queue in Postfix MTA .

First run the command mailq command to check how many mails are in queue

To clear/remove the mail queue in postfix,read the below given scenarios

  • Scenario 1 : Remove particular mail queue id (on running mailq command,you will get mail queue id)
postsuper -d mail_queue_id
  • Scenario 2: Remove ALL mails from queue
postsuper -d ALL
  • Scenario 3: Remove only ALL deferred mails which are in queue
postsuper -d ALL deferred