Wednesday 27 June 2012

Postfix mail queue and its operations


Postfix mail queue
In this article, I am going to explain you how flush a postfix mail queue and its operation in details. Suppose if you are handling a MTA(Mail Transfer Agent) then you must have to know about these. Basically postfix consists of four different types of  queues such as


* active queue - it is limited size queue which contains mails to be sent out.
* deferred queue - mails that cannot be delivered will stored in the deferred queue.
* incoming queue - mails from network will first enter in to incoming queue and after some cleanup it will give it to active queue for mail delivery.
* maildrop queue - it consists of locally posted mails.



Let us see now various queue operations.


Flushing the mail queue:


In order a flush a mail queue, run the following command 


# postfix flush 
or
# postfix -f
or
# postqueue -f 


Moving mails to hold queue:

Sometimes there may be a situation that we need move all mails to hold queue and then release at later time for resending. So run the following command to move the mails from deferred, active to hold queue.


# postsuper -h ALL

Here it moves all mails on active, incoming and deferred queue to hold queue.


Also you can move the mails from a particular queue to  hold queue by using the following command.


# postsuper -h ALL deferred

To release all the messages from hold queue, run the following command

# postsuper -H ALL

Requeue mails in a mail queue:

In order to requeue the mails in a mail queue, run the following command


# postsuper -r  ALL

By default it will requeue all the mails in active, deferred, hold and incoming queue, then it place all those mails to maildrop queue for delivery.


Deleting mails from postfix queue:


To delete a mail from particular mail queue, then run the following command


# postsuper -d ALL deferred
or
# postsuper -d ALL active


The above command will delete mails from the specified queue.


Here is another option to delete all mails from all mail queue


# postsuper -d ALL

1 comment: