User Tools

Site Tools


notes:mailqueue

Manage the postfix mailqueue

Display a list of queued mail, deferred and pending

mailq

or

postqueue -p

View message (contents, header and body)

Assuming the message has the ID XXXXXXX (you can see the ID form the QUEUE)

postcat -vq XXXXXXXXXX

Process the Queue

postqueue -f

or

postfix flush

Halt/Resume Queue

If your server has very high load and you want to temporarily move all message from the incoming queue to the hold queue, use the command:

postsuper -h ALL

To move the messages back to the incoming queue, use the command:

postsuper -r ALL

Delete message(s)

Delete a message by message ID

postsuper -d MessageID

Delete all queued mail

postsuper -d ALL

Delete differed mail queue messages, those the system will retry later

postsuper -d ALL deferred

Remove emails by sender (hacked account spamming?)

mailq | tail +2 | grep -v '^ *(' | awk  'BEGIN { RS = "" } { if ($7 == “spamming@example.com” && $9 == “”) print $1 } ‘ | tr -d ‘*!’ | postsuper -d -

Remove emails by recipient (highly spammed account?)

mailq | tail +2 | grep -v '^ *(' | awk  'BEGIN { RS = "" } { if ($8 == "spammed@example.com" && $9 == "") print $1 } ' | tr -d '*!' | postsuper -d -

Remove emails by sender hostname

mailq | grep senderhostname | awk ‘{ print $1′} | postsuper -d -
notes/mailqueue.txt · Last modified: 2014/08/28 11:04 by admin