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:
    -Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
    561251991FE0* 2865 Sun Mar 9 09:17:15 MAILER-DAEMON
    cb-0caraway@holtecnet.com

    DFDB61991287* 3126 Sun Mar 9 09:19:23 MAILER-DAEMON
    Philip-0eniarom@holtecnet.com

    75FB31991349* 2893 Sun Mar 9 09:19:08 MAILER-DAEMON
    0jarring@holtecnet.com

    D164819912BF* 4101 Sun Mar 9 09:19:12 MAILER-DAEMON
    _0gubdeb@holtecnet.com

    26B521991480* 4055 Sun Mar 9 09:19:14 MAILER-DAEMON
    0ecilam1985@holtecnet.com

    478F51991254* 3632 Sun Mar 9 09:19:18 MAILER-DAEMON
    Chuck-0potse@holtecnet.com

    A26F219912B2* 2944 Sun Mar 9 09:19:26 MAILER-DAEMON
    JHON-0sanoj@holtecnet.com

    D413519912E6* 3040 Sun Mar 9 09:19:32 MAILER-DAEMON
    lechat-0repus@holtecnet.com

    CFE871991495* 3409 Sun Mar 9 09:19:37 MAILER-DAEMON
    _0esnes@holtecnet.com

    D8C0019914BD* 3472 Sun Mar 9 09:19:43 MAILER-DAEMON
    _0rotceps@holtecnet.com

    1CFE61991FF0* 2940 Sun Mar 9 09:19:09 MAILER-DAEMON
    _0kolkhoz@holtecnet.com

    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.

    www.holtecnet.com 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 Howtoforge Staff

    If you want to clear the whole mail queue, run
    Code:
    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" ?

    Sandip
     
  4. minskog

    minskog New Member

    I have this script for this situations ;)

    Code:
    #!/bin/bash
    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

    Thanks,

    Your full script is not visible. Can you please post the full code or send me at sandiphw@hotmail.com?

    Sandip
     
  6. Hans

    Hans Moderator Moderator

    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