Welcome to the JaguarPC Community
JaguarPC
Sales: (888) 338-5261
Support: (888)-551-3050
Results 1 to 6 of 6

This is a discussion on Automatically Delete Old Emails In Mailbox in the VPS & Dedicated forum
Currently all the users in our company have their own mail box on our vps hosted here that they can log in to using web ...

  1. #1
    Loyal Client Pawel Kowalski's Avatar
    Join Date
    Sep 2001
    Location
    Albuquerque NM
    Posts
    1,405

    Automatically Delete Old Emails In Mailbox

    Currently all the users in our company have their own mail box on our vps hosted here that they can log in to using web mail incase there is an issue where they can't connect to their outlook remotely. I would like to move all our clients to an exchange server. This exchange server will connect to a new email account I created in cPanel (exchange@domain.com) using pop3 every minute and route the appropriate mail to the user's exchange mail box. I wanted to keep the ability for our users to connect to cPanel's web mail incase there is an internal network error and they can't connect to their desktops to check outlook. So I set up a forwarder that will route all emails to the new mail box I created on the server which creates 2 copies, one in the exchange@domain.com and the other in the user's own personal mail box on the VPS here.

    I set up my pop3 connector to automatically delete each email that is pulled off exchange@domain.com but I have no way to delete the emails off the server in the user's email account. Is there any way to do this in cPanel or through a cron job? Let's say that all email older than 30 days gets automatically deleted, is that possible?

  2. #2
    Community Leader jason's Avatar
    Join Date
    Sep 2001
    Location
    Rochester, NY
    Posts
    6,003
    It shouldn't be difficult if you are using Courier IMAP on the VPS--each message is stored as a single file. All you'd have to do is loop through the directory checking the modification time on those files. Anything older than a target time get deleted.

    --Jason
    Jason Pitoniak
    Interbrite Communications
    www.interbrite.com www.kodiakskorner.com

  3. #3
    all about nothing! Frank Broughton's Avatar
    Join Date
    Jan 2006
    Posts
    2,158
    There used to be a feature in cPanel to purge email based on age - it disappeared many updates ago. So, if it was possible then, it should be now. I do not know how though. I wish the feature came back.

  4. #4
    Loyal Client Pawel Kowalski's Avatar
    Join Date
    Sep 2001
    Location
    Albuquerque NM
    Posts
    1,405
    Quote Originally Posted by jason View Post
    It shouldn't be difficult if you are using Courier IMAP on the VPS--each message is stored as a single file. All you'd have to do is loop through the directory checking the modification time on those files. Anything older than a target time get deleted.

    --Jason
    Which directory would these files be stored in? If it is just a simple file I could probably come up with a simple php file that can sort through them all. Thanks.

  5. #5
    Community Leader jason's Avatar
    Join Date
    Sep 2001
    Location
    Rochester, NY
    Posts
    6,003
    /home/USER/mail, I believe. From there is is broken down by domain and then by user. If memory serves me correct, each mail folder is actually two folders, one called cur and I don't remember the other name--cur, I believe, contains unread mail and the other contains anything that's been looked at. There are also dot-folders, such as .spam which equate to IMAP folders in the mail client and these have the same two directory structure to them (and potentially more dot-folders as well).

    --Jason
    Jason Pitoniak
    Interbrite Communications
    www.interbrite.com www.kodiakskorner.com

  6. #6
    Loyal Client Pawel Kowalski's Avatar
    Join Date
    Sep 2001
    Location
    Albuquerque NM
    Posts
    1,405
    I'll take a look to see what I can find, thanks again Jason.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •