Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 13 of 13
  1. #1
    Member
    Join Date
    Jan 2004
    Posts
    51

    Default Delete all mail in user's mailbox

    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)
    Alex Monaghan, Monaghan Consultants Ltd
    www.monaghan.co.uk - IT / Database consultancy
    www.www-hoster.com - International web hosting
    www.diyhosting.co.uk - Quality budget web hosting

  2. #2
    Super Moderator This forum account has been confirmed by cPanel staff to represent a vendor. chirpy's Avatar
    Join Date
    Jun 2002
    Location
    Go on, have a guess
    Posts
    13,495

    Default

    Yes, you can just delete the file.
    Jonathan Michaelson

    Need your cPanel servers secured and tuned?
    cPanel Server Configuration, Security, Recovery and Antivirus/AntiSpam Services
    Developers of the most effective (and free) Firewall & Security Solution for cPanel Servers - csf
    http://www.configserver.com

  3. #3
    Member
    Join Date
    Jan 2004
    Posts
    51

    Default

    Many thanks, I've done this many times on non cPanel boxes, just a bit twitchy doing it on a live cPanel box
    Alex Monaghan, Monaghan Consultants Ltd
    www.monaghan.co.uk - IT / Database consultancy
    www.www-hoster.com - International web hosting
    www.diyhosting.co.uk - Quality budget web hosting

  4. #4
    Super Moderator This forum account has been confirmed by cPanel staff to represent a vendor. chirpy's Avatar
    Join Date
    Jun 2002
    Location
    Go on, have a guess
    Posts
    13,495

    Default

    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.
    Jonathan Michaelson

    Need your cPanel servers secured and tuned?
    cPanel Server Configuration, Security, Recovery and Antivirus/AntiSpam Services
    Developers of the most effective (and free) Firewall & Security Solution for cPanel Servers - csf
    http://www.configserver.com

  5. #5
    Member
    Join Date
    Nov 2004
    Posts
    38

    Default

    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. #6
    Member
    Join Date
    Mar 2005
    Posts
    29

    Default

    There is an article on removing spam via cron already search through the forums.

    Thanks

  7. #7
    Member rpmws's Avatar
    Join Date
    Aug 2001
    Location
    back woods of NC, USA
    Posts
    1,858

    Default

    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.
    Just keeping my "eye" on things....
    R. Paul Mathews
    RPMWS - diehard cPanel Nutcase

  8. #8
    Member casey's Avatar
    Join Date
    Jan 2003
    Location
    If there is trouble, it will find me
    Posts
    2,336

    Default

    Quote Originally Posted by rpmws
    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.
    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. #9
    Member PWSowner's Avatar
    Join Date
    Nov 2001
    Location
    ON, Canada
    Posts
    2,994

    Default

    Quote Originally Posted by casey
    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.
    I've had to do that too, but I cheated and wrote a quick little script to do it for me.
    Mike
    WHM and cPanel Scripts (join our "Scripts Club")
    D/A Photography

  10. #10
    Member casey's Avatar
    Join Date
    Jan 2003
    Location
    If there is trouble, it will find me
    Posts
    2,336

    Default

    Quote Originally Posted by PWSowner
    I've had to do that too, but I cheated and wrote a quick little script to do it for me.
    You smart people and your toys....

  11. #11
    cPanel Partner NOC cPanel Partner NOC Badge
    Join Date
    Apr 2002
    Posts
    686
    cPanel/Enkompass Access Level

    DataCenter Provider

    Default

    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. #12
    Super Moderator This forum account has been confirmed by cPanel staff to represent a vendor. chirpy's Avatar
    Join Date
    Jun 2002
    Location
    Go on, have a guess
    Posts
    13,495

    Default

    Just delete the individual mail files from the respective directory (cur new).
    Jonathan Michaelson

    Need your cPanel servers secured and tuned?
    cPanel Server Configuration, Security, Recovery and Antivirus/AntiSpam Services
    Developers of the most effective (and free) Firewall & Security Solution for cPanel Servers - csf
    http://www.configserver.com

  13. #13
    Member brianoz's Avatar
    Join Date
    Mar 2004
    Location
    Melbourne, Australia
    Posts
    1,117
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    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".

Similar Threads & Tags
Similar threads

  1. Option to delete mail queue by user
    By DjiXas in forum Feature Requests for cPanel/WHM
    Replies: 2
    Last Post: 01-14-2011, 12:58 PM
  2. backend mailbox create/delete hook
    By planetsphinx in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 09-27-2006, 10:44 AM
  3. Delete entire mailbox content in one sweep
    By peteraloha in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 09-26-2005, 08:44 PM
  4. /home/user/mail/mailbox VS /home/user/mail/domain/mailbox
    By PWSowner in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 07-18-2005, 01:55 AM
  5. Mail not arriving in user's mailbox?
    By nothsa in forum cPanel and WHM Discussions
    Replies: 5
    Last Post: 06-25-2005, 04:00 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube