[SOLVED] deleting mail from postfix mail queue after spam attack

Discussion in 'Server Operation' started by Tomislav Aurednik, May 30, 2017.

  1. Tomislav Aurednik

    Tomislav Aurednik Member HowtoForge Supporter

    Hi... after a spam attack I need to clear the postfix mail queue for the address [email protected]. I tryed the command described in
    https://www.howtoforge.com/delete-mails-to-or-from-a-specific-email-address-from-postfix-mail-queue
    That didn't work I gotten a error "cannot open ‘+2’ for reading: No such file or directory".
    After that I tryed this command that I found on this forum.
    mailq | tail -n +2 | awk 'BEGIN { RS = "" } / admin@change\.me$/ { print $1 }' | tr -d '*!' | postsuper -d -
    It run with no error but it didn't delete the mail from the queue. I'm running Ubuntu 14.04.
    Does any one know the correct command?
     
  2. Tomislav Aurednik

    Tomislav Aurednik Member HowtoForge Supporter

    Found the right command
    mailq | tail -n +2 | awk 'BEGIN { RS = "" }{ if ( $7 == "[email protected]" ) print $1 }' | tr -d '*!' | postsuper -d -
     
  3. ruliezz

    ruliezz Member

  4. Tomislav Aurednik

    Tomislav Aurednik Member HowtoForge Supporter

Share This Page