Remove all Postfix queue items

By Jamsi • Dec 20th, 2006 • Category: Linux

Handy!

postsuper -d ALL


       -d queue_id
              Delete one message with the named queue ID from the
              named   mail  queue(s)  (default:  hold,  incoming,
              active and deferred).

              If a queue_id of - is specified, the program  reads
              queue  IDs  from  standard  input.  For example, to
              delete  all  mail  with   exactly   one   recipient
              user@example.com:

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

              Specify "-d ALL" to remove all messages; for  exam-
              ple,  specify  "-d ALL deferred" to delete all mail
              in the deferred queue.  As a  safety  measure,  the
              word ALL must be specified in upper case.

Related posts:

  1. Dealing with Duplicate emails in Postfix


FREE NEWSLETTER -> Want Tech Tips Sent Straight to your Inbox?

Grab our Newsletter to Ensure your PC is Running Smooth!

Jamsi is currently studying a full time Bachelor of Computer/Business degree and working part time as an Internet Security Consultant.
Email this author | All posts by Jamsi

Leave a Reply