remove similar mails from mailqueue

Discussion in 'Help Desk' started by DearWebby, Apr 23, 2015.

  1. DearWebby

    DearWebby Greylisted

    Joined:
    Apr 23, 2015
    Messages:
    5
    Likes Received:
    1
    How can I delete a big bunch of mails from the mailqueue without hunting each ones two files down with locate and manually delete them?
    Is there a command for that?
    Or has somebody ever written a bash script for that, that takes for example the FROM address and dumps all mails with that FROM address from the queue?
    I hope whoever comes up with a bash script for that can accept PayPal!
    Thanks
    DearWebby
     


  2. popowich

    popowich EQ Forum Admin Staff Member

    Joined:
    Aug 12, 2008
    Messages:
    8,986
    Likes Received:
    120
    Hello,

    Here is the example for Postfix in case anyone looking for a solution for that MTA lands here:

    http://www.emailquestions.com/postfix/9369-delete-all-email-domain-one-email-address.html

    I found this example for sendmail but did not test it yet:

    > find /var/spool/mqueue -name "[d,q,Q,D]f*" -exec grep -nil "username@example.com" {} \; | xargs rm

    It needs to be adjusted to match your queue directory and the email address of the sender of you want removed from the queue.

    If this happens to be a lot of spam on a web server I'd also check your web sites for compromised web forms and/or WordPress plugins being used to send spam.
     

Want to reply or ask your own question?

It only takes a minute to sign up (and it's free!). Click the orange sign up button to choose a username and then you can ask your own questions on the forum.
Loading...