The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Delete all mail in user's mailbox

Discussion in 'E-mail Discussions' started by monaghan, Nov 23, 2005.

  1. monaghan

    monaghan Well-Known Member

    Joined:
    Jan 7, 2004
    Messages:
    51
    Likes Received:
    0
    Trophy Points:
    6
    I have a user with over 100Mb of mail, they have not been monitoring their default mailbox and didn't set it to default to a mailbox they do monitor :(

    I've been asked to purge the default mailbox, can I simply delete the user's /~username/mail/inbox ?

    I've not yet converted to maildir (if that makes a difference)
     
  2. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    Yes, you can just delete the file.
     
  3. monaghan

    monaghan Well-Known Member

    Joined:
    Jan 7, 2004
    Messages:
    51
    Likes Received:
    0
    Trophy Points:
    6
    Many thanks, I've done this many times on non cPanel boxes, just a bit twitchy doing it on a live cPanel box :)
     
  4. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    The kindest way is usually to empty it rather than delting it, i.e.

    cat /dev/null > /path/to/inbox

    or

    >/path/to/inbox

    if you prefer. However, there's usually no issue with simply deleting the file, exim will recreate it if it needs to to deliver new email.
     
  5. WindyT

    WindyT Active Member

    Joined:
    Nov 30, 2004
    Messages:
    39
    Likes Received:
    0
    Trophy Points:
    6
    On a related note,

    How do you empty everyone's spam box across the server.
    Ultimately, I'd like to set a cron to do this on Sunday nights.

    Setting one spam box to empty is one thing, but I'm wary of trying a catchall to delete everyone's.

    Or am I just going about this the wrong way?

    Thanks
     
  6. krystalx

    krystalx Active Member

    Joined:
    Mar 27, 2005
    Messages:
    29
    Likes Received:
    0
    Trophy Points:
    1
    There is an article on removing spam via cron already search through the forums.

    Thanks
     
  7. rpmws

    rpmws Well-Known Member

    Joined:
    Aug 14, 2001
    Messages:
    1,824
    Likes Received:
    5
    Trophy Points:
    38
    Location:
    back woods of NC, USA
    here is a quick question while we are on this subject. Let's say you are using maildir and a users new or cur folder has so many emails in it that you get an error when you do a rm * ?? something like too many arguments or files to delete.
     
  8. casey

    casey Well-Known Member

    Joined:
    Jan 17, 2003
    Messages:
    2,303
    Likes Received:
    0
    Trophy Points:
    36
    Location:
    If there is trouble, it will find me
    Good question. I had this same issue before with a non-mail directory. I ended up doing
    rm -rf a*
    rm -rf b*
    rm -rf c*
    and so on. It was a real pain.
     
  9. PWSowner

    PWSowner Well-Known Member

    Joined:
    Nov 10, 2001
    Messages:
    2,948
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    ON, Canada
    I've had to do that too, but I cheated and wrote a quick little script to do it for me. ;)
     
  10. casey

    casey Well-Known Member

    Joined:
    Jan 17, 2003
    Messages:
    2,303
    Likes Received:
    0
    Trophy Points:
    36
    Location:
    If there is trouble, it will find me
    You smart people and your toys.... :p
     
  11. Snowman30

    Snowman30 Well-Known Member
    PartnerNOC

    Joined:
    Apr 7, 2002
    Messages:
    681
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    DataCenter Provider
    If an account is using maildir how can we purge that specific account?

    I found a site that has over 50000 emails in their catchall and its just way too slow to try and do it via webmail...
     
  12. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    Just delete the individual mail files from the respective directory (cur new).
     
  13. brianoz

    brianoz Well-Known Member

    Joined:
    Mar 13, 2004
    Messages:
    1,146
    Likes Received:
    6
    Trophy Points:
    38
    Location:
    Melbourne, Australia
    cPanel Access Level:
    Root Administrator
    The nice thing about maildir is that it's really easy to remove (age) individual messages now - something like:

    cd ~user/mail/theirdomain.com/person (alter as needed)
    find cur new -name '????*' -mtime +14 -print | xargs rm -f

    which removes files older than 14 days, the '????*' bit is to avoid removing "cur" or "new".
     
Loading...

Share This Page