1. Click on the Cron jobs icon in your cpanel
2. Open the cron manager.
3. To delete all the emails under your default account that are older than 10 days, We acan setup a cron that runs during a particular time everday
To do this enter the following information in the following fields:
Command: /usr/bin/archivemail –quiet –delete –days 7 /home/user/mail/inbox
Replace user with your actual username(i.e cpanel username).
4. Click on the Commit Changes button
5. At 2.25 am all mails that are older than 7 days in your inbox will be deleted.
If you wanted to have all the emails deleted that are older than 2 days you would simply change the –days option to 2
To delete all emails inside your mail directory including sent mail, spam, etc. that are older than 20 days
/usr/bin/archivemail –quiet –delete –days 20 /home/user/mail/*
To delete all the emails of a particular email account of your domain in that inbox that are older than six days deleted…
/usr/bin/archivemail –quiet –delete –days 6 /home/user/mail/yourdomain.com/info/inbox
To delete sent mail folder
/usr/bin/archivemail –quiet –delete –days 21 /home/user/mail/yourdomain.com/info/sent-mail
To delete the emails older than 1 month please use the below command
Command: /usr/bin/archivemail –quiet –delete –months 1 /home/user/mail/inbox