Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 9 of 9
  1. #1
    Member
    Join Date
    Aug 2004
    Posts
    472

    Default deleting email older than 30 days

    Hello,

    How can we set up cron in cpanel that will delete mail from the inbox that is older than 30 days? Or can we setup this option in any of the webmail or outlook any ideas?? Or can we write any php script for this to delete mail from a specific inbox and set this script as a cron to run once in every month like that ?? any ideas of this??

    Regards,
    David

  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

    There's always the Aging option that cPanel have added available within cPanel > Mail > Manager Accounts > Aging:
    Mail aging is the process in which e-mails will be removed from the server automatically, upon successful log out of a pop3 session. This deletion will only occur if the messages are older then a specified amount of days.
    Other than that cludge, I'm not aware of a solution to do this nicely. Unfortunately, too many people leave mail on the server in POP3 accounts, when the protocol was never designed with that in mind. It's meant to be a temporary store that the user retrieves in its entirety and then deletes once received. So, it really is the users responsibility to delete their email after they have received it. That said, I'm not aware of any scripts that do what you're looking for, but they may be out there.
    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
    Aug 2004
    Posts
    472

    Default

    THANKS THANKS THANKS THANKS

    It works..

  4. #4
    Member
    Join Date
    Feb 2005
    Posts
    80

    Default

    Quote Originally Posted by chirpy
    There's always the Aging option that cPanel have added available within cPanel > Mail > Manager Accounts > Aging:


    Other than that cludge, I'm not aware of a solution to do this nicely. Unfortunately, too many people leave mail on the server in POP3 accounts, when the protocol was never designed with that in mind. It's meant to be a temporary store that the user retrieves in its entirety and then deletes once received. So, it really is the users responsibility to delete their email after they have received it. That said, I'm not aware of any scripts that do what you're looking for, but they may be out there.

    does it even works when we check the mail through webmail?

  5. #5
    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

    No idea, but I doubt it.
    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

  6. #6
    Registered User
    Join Date
    Feb 2006
    Posts
    1

    Default Aging not working

    Aging not working for me either. I have several email accounts set up and mail is being forwarded from the various addresses to my primary address. When I log in I am able to get all of my forwarded mail OK and then my email client (Eudora) deletes from server. However, mail is NOT deleted from the accounts that forwarded the mail to my primary account. So, I set aging to 1 day. However, it NEVER works. When I go back into my accounts the old email is always on the server. After reading the various posts here and working with aging myself my conclusion is that it just isn't working - so it's a bug in the software. My hosting company can't figure it out either. In the .pdf doc file for cPanel aging isn't even mentioned.
    Tom Loffman

  7. #7
    Member
    Join Date
    Jul 2004
    Posts
    496

    Default

    I don't know how do do this for all inboxes but for just one inbox, you could set up a cron to run every x days with the command something like:
    Code:
    cd /home/username/mail | echo -n > inbox
    This would delete the contents of the inbox file without deleting the actual inbox !!!

  8. #8
    Member
    Join Date
    Aug 2004
    Posts
    8

    Default

    seems that would be a bad idea. what if there is mail unread and the cron is ran and your important data is deleted.

  9. #9
    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

    Indeed, that would be a terrible idea - you would almost definitely lose email. The best solution is really to educate users in how email works. That they should use POP3 if they want to retrieve email immediately and to not use their email clients option to leave email on the server. OR to use IMAP if they want to leave email on the server. Email and account quotas are there to prevent users doing stupid things like leaving email on the server that they should be retrieving locally.
    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

Similar Threads & Tags
Similar threads

  1. Delete mail queue older than 3 days
    By jameshsi in forum cPanel and WHM Discussions
    Replies: 10
    Last Post: 10-07-2005, 06:34 AM
  2. Mail queue isn't deleting older messages.
    By gflamerich in forum cPanel and WHM Discussions
    Replies: 7
    Last Post: 10-05-2005, 06:37 PM
  3. Delete emails from spam box older than x days
    By Netmaking in forum cPanel and WHM Discussions
    Replies: 4
    Last Post: 12-02-2004, 08:05 AM
  4. Delete messages in queue older than xx days ?
    By pguy in forum cPanel and WHM Discussions
    Replies: 7
    Last Post: 02-02-2004, 01:40 PM
  5. How to delete email that is older than x amount of days?
    By Roberto in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 01-09-2004, 05:55 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube