Delete spam mail from queue

Discussion in 'Server Operation' started by sandiphw, Mar 11, 2008.

  1. sandiphw

    sandiphw New Member

    We are receiving thousands of mails having unknown recipients in our domain which all paralyzed our mail system. Please see the mails stucked up in
    -Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
    561251991FE0* 2865 Sun Mar 9 09:17:15 MAILER-DAEMON
    [email protected]

    DFDB61991287* 3126 Sun Mar 9 09:19:23 MAILER-DAEMON
    [email protected]

    75FB31991349* 2893 Sun Mar 9 09:19:08 MAILER-DAEMON
    [email protected]

    D164819912BF* 4101 Sun Mar 9 09:19:12 MAILER-DAEMON
    [email protected]

    26B521991480* 4055 Sun Mar 9 09:19:14 MAILER-DAEMON
    [email protected]

    478F51991254* 3632 Sun Mar 9 09:19:18 MAILER-DAEMON
    [email protected]

    A26F219912B2* 2944 Sun Mar 9 09:19:26 MAILER-DAEMON
    [email protected]

    D413519912E6* 3040 Sun Mar 9 09:19:32 MAILER-DAEMON
    [email protected]

    CFE871991495* 3409 Sun Mar 9 09:19:37 MAILER-DAEMON
    [email protected]

    D8C0019914BD* 3472 Sun Mar 9 09:19:43 MAILER-DAEMON
    [email protected]

    1CFE61991FF0* 2940 Sun Mar 9 09:19:09 MAILER-DAEMON
    [email protected]

    How can I delete all these junk mails at a single command as per your suggestion? I don't have the e-mail of sender of these mails. is our domain. We are using zimbra 3.1.1 on Fedora 5.

    Any help regarding this will be highly appreciated.

    Sandip K Sadhukhan
  2. falko

    falko Super Moderator ISPConfig Developer

    If you want to clear the whole mail queue, run
    postsuper -d ALL
  3. sandiphw

    sandiphw New Member

    That will delete necessary mails also. Is there anyway I can delete mails only from "MAILER-DAEMON" ?

  4. minskog

    minskog New Member

    I have this script for this situations ;)

    mailq | tail -n +2 | grep -v '^ *(' | awk  'BEGIN { RS = "" }
    # $7=sender, $8=recipient1, $9=recipient2
    { if ($7 == "MAILER-DAEMON" )
        print $1 }
    ' | tr -d '*!' | postsuper -d -
  5. sandiphw

    sandiphw New Member


    Your full script is not visible. Can you please post the full code or send me at [email protected]?

  6. Hans

    Hans Moderator ISPConfig Developer

    Yes that's true, but you can also:

    postsuper -r *QUEUE ID* (for releasing one)
    postsuper -r ALL (for releasing ALL)
    postsuper -d *QUEUE ID* (for deleting one)
    postsuper -d ALL (for deleting ALL)


Share This Page