Community Forums
Connect with us on LinkedIn
Community Notice
+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Jan 2010
    Posts
    2

    Default Auto Delete Emails in Multiple Email Accounts at once

    I need to be able to delete any and all emails from multiple email accounts at once. Is this possible to have maybe a Cron job run this every week or something like that? I have the passwords to all 1500+ email accounts on my server and I just need to be able to delete all contents of email accounts every week or so.

  2. #2
    cPanel Staff cPanelMatt's Avatar
    Join Date
    Apr 2005
    Location
    Houston, TX
    Posts
    409

    Default

    Well, there is no way to do this via the APIs unless you were to do something like remove & readd the accounts once a week. The easiest way to do this would be by manually removing files inside of the users maildir at:

    /home/$username/mail/.$email_username/cur/* - READ inbox message
    /home/$username/mail/.$email_username/new/* - UNREAD inbox messages
    /home/$username/mail/.$email_username/*/new/* - UNREAD mail folder messages
    /home/$username/mail/.$email_username/*/cur/* - READ mail folder messages

    After this has been done for all accounts, /scripts/generate_maildirsize should probably be run to ensure that correct mailbox usage is correct accounted for.
    Matt Dees
    Integration Developer
    cPanel, Inc.
    cPanel Integration Blog

  3. #3
    Registered User
    Join Date
    Jan 2010
    Posts
    2

    Default

    I found a cron job to do it for me:

    find /home/*/mail/*/*/*/* -type f -mtime +1 | xargs rm -rf

    It works and it deletes everything.

Similar Threads & Tags
Similar threads

  1. how to auto delete all emails older than 2 years (cpanel)? Any scripts?
    By ramystyle in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 06-14-2009, 12:37 PM
  2. Forward emails and auto delete from inbox.
    By lazydayz in forum E-mail Discussions
    Replies: 4
    Last Post: 12-18-2007, 02:07 PM
  3. how to auto reject and delete emails like this?
    By roby2k in forum cPanel and WHM Discussions
    Replies: 5
    Last Post: 02-07-2007, 08:59 AM
  4. Spamassassin Auto Delete Spam Emails
    By cheemin in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 09-01-2006, 12:15 AM
  5. delete multiple accounts
    By hllMedia in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 04-08-2003, 03:10 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube