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.

Email retention policy

Discussion in 'E-mail Discussions' started by tiagom, Sep 27, 2012.

  1. tiagom

    tiagom Member

    Joined:
    Sep 27, 2012
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Is it possible to have email retention policies? Like exchange does.

    Does cpanel support it out of the box? Is there an addon that does it?


    Any help is much appreciated.
     
  2. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Hello,

    Could you clarify what is meant by email retention policy specifically? Please just provide details on exactly what you are looking for and we can see if this is available or not.

    Thanks!
     
  3. tiagom

    tiagom Member

    Joined:
    Sep 27, 2012
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Sure, I am talking about a policy that you define preferably per user.

    For example any emails older then 365 days are automatically deleted from the email server.

    Or all emails older then 365 days except email in a particular directory(for example "Important") to be deleted.
     
  4. pwhjenny

    pwhjenny Well-Known Member

    Joined:
    Aug 31, 2012
    Messages:
    135
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    Root Administrator
    As far as I know no script exist to accomplish what you looking for. However you may setup your very own cron to delete the messages using mtime and find command.
     
  5. tiagom

    tiagom Member

    Joined:
    Sep 27, 2012
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Can you provide an example that excludes directories called "Important" please.
     
  6. WebScHoLaR

    WebScHoLaR Well-Known Member

    Joined:
    Dec 14, 2005
    Messages:
    511
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    Planet Earth
    You can have something like

    find /home/*/mail/*/*/cur -type f -mtime +365 \( ! -name important \) -print | xargs rm -f
     
  7. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    I cannot foresee any option we would allow to remove emails after a set age in cPanel by any user other than the email account level user.

    This is because we avoid deleting customer data. In fact, removing that data without informing the customer could be a liability or legal issue in some countries.
     
  8. tiagom

    tiagom Member

    Joined:
    Sep 27, 2012
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Well we currently use cpanel to manage our company email. We have a dedicated server with the sole purpose of providing our email and webhosting services.

    We have a company document retention policy that we have to adhere to. Which involves purging any emails older then 1 year old. Making custom rules for 200+ users is time consuming.

    Personally i dislike cpanel and would not recommend it for any business hosting. It lacks too many email features that business. I would love for the company to switch to Exchange, hopefully they budget it in for next year...





    Incase anyone search for this feature what i have done is just make a Cron job with the following command..

    find -P /home/[user or *]/mail/[domain or *]/* -mindepth 2 -mtime '+365' -type f | grep -v '/Important' | xargs -I {} rm -r "{}"

    This deletes any emails older then 1 year, it excludes the directory "Important" and can delete emails with spaces in the path.
     
  9. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Managing the company's email probably shouldn't be done on a cPanel machine, but a machine dedicated just to email yes without a full control panel. I don't see how that has to do anything with webhosting itself, since the company email for the business on a dedicated machine differs greatly from the general purpose of cPanel to provide basic ease of use services for web hosting.

    Of course, you have a right to your opinion.
     
  10. MontysDouble

    MontysDouble Member

    Joined:
    Oct 26, 2012
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Indeed, I think the kind of email and user management you are after goes WAY beyond being suitable for cpanel (simple mailboxes, on a platform for managing hosting), etc. Not the right tool for the job etc.

    There are main mail servers out there, personally I have used and like Kerio (and I know it would do what you need, without the headaches of something like Exchange, etc). But many products are available, some might be better suited, I don't know your problem.
     
  11. cPanelNick

    cPanelNick Administrator
    Staff Member

    Joined:
    Mar 9, 2015
    Messages:
    3,426
    Likes Received:
    2
    Trophy Points:
    38
    cPanel Access Level:
    DataCenter Provider
  12. tiagom

    tiagom Member

    Joined:
    Sep 27, 2012
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Exchange has a full management console, same principle. I am sure there are other users looking for more "advanced" options for mailbox control.

    Cool product but since the entire company's backbone is windows the integration between AD and Exchange is one of the major selling point for myself.

    Cool feature but seems silly to me to generate a separate directory for each each day. Why not just one "Archive" directory?



    Regardless our email will remain on a dedicated cPanel server until/if exchanged is budgeted in. Just wish it had more features. Can't wait until CalDav is finally implemented.
     
  13. MontysDouble

    MontysDouble Member

    Joined:
    Oct 26, 2012
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    If your network is already a managed windows domain model, then yes lots of Exchange features can be valuable. I had assumed you only needed a relativly basic setup, hence cPanel met your needs, but you were not only just starting to out grow it.

    N.b. Kerio can do Windows domain integration - i.e. automatically setup users from the AD, also single sign on, etc. And outlook integration.

    If however you are a fully blown MS AD setup, then exchange migth well be the way to go.
     
  14. rs-freddo

    rs-freddo Well-Known Member

    Joined:
    May 13, 2003
    Messages:
    832
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Australia
    cPanel Access Level:
    Root Administrator
    Thanks for this info, As a hosting provider I have more problems with clients who keep email they don't want. Giving them email archiving where they can store even more mail they don't want - is beyond useless. I have been thinking of offering some sort of automatic email deleting as a service, because as you know most clients unknowingly have the setting to store email on the server checked these days. Getting a client to check their email settings is way beyond most hosting clients.
     
  15. tiagom

    tiagom Member

    Joined:
    Sep 27, 2012
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    My point exactly.

    Look unless you are legally bound to keep emails for a set amount of time (Lawyer, Accountant, ect..). It is absolutely pointless to keep emails beyond X amount of years.

    Silly to provide a way to infinity store emails but not a way to limit them.
     
  16. tiagom

    tiagom Member

    Joined:
    Sep 27, 2012
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Just wanted to update the Cron job i provided earlier for anyone using this as i ran into a conditions that i needed to be able to handle.

    This now can handle quotes in a folder name but the solution added a % which has to be escaped to run as a cronjob.

    find -P /home/[user or *]/mail/[Domain or *]/ -mindepth 2 -mtime '+366' -type f -printf '"\%p"\n' | grep -v '/Important' | grep -v '/.Important' | xargs -I {} rm -r "{}"

    If you want to use it in a shell instead change -printf '"\%p"\n' to -printf '"%p"\n'
     
  17. webstyler

    webstyler Well-Known Member

    Joined:
    Nov 20, 2003
    Messages:
    432
    Likes Received:
    0
    Trophy Points:
    16
    why -r attribute for rm ?
     
Loading...

Share This Page