Eric
If you have a mailbox that is always filling up with mail like your default account or your spam box and you don't want to have to keep logging in and deleting the emails manually this howto will show you how you can have it automatically deleted.
Step 1.
Login to your cpanel and click on the Cron jobs icon. Next click on the Advanced (Unix Style) button to open the cron manager.
Step 2.
Now let's say you want to have all the emails in your default email accounts inbox deleted that are older than 10 days and have it run at 1:30 AM each day.
To do this enter the following information in the following fields:
Minute: 30
Hour: 01
Day: *
Month: *
Weekday: *
Command: /usr/bin/archivemail --quiet --delete --days 10 /home/<USER>/mail/inbox
Make sure you replace <USER> with your actual cpanel username. So for example, if your username was cpanel, you would enter:
/usr/bin/archivemail --quiet --delete --days 10 /home/cpanel/mail/inbox
Step 3.
Hit the Commit Changes button and wait until sometime after 1:30 AM (assuming you set it up to run at that time) and login to your default email account to see if your emails have been deleted. If everything looks good your default inbox will now have any emails that are older than 10 days automatically deleted. To login into your default email account you use your cpanel username and password. That's all there is to it.
Miscellaneous notes and examples.
If you wanted to have all the emails in your default inbox deleted that are older than two days you would simply change the --days option to 2:
/usr/bin/archivemail --quiet --delete --days 2 /home/<USER>/mail/inbox
If you wanted to have all emails inside your mail directory including sent mail, spam, etc. that are older than 20 days deleted:
/usr/bin/archivemail --quiet --delete --days 2 /home/<USER>/mail/*
If you had an email account named info@yourdomain.com (info@yourdomain.com) and wanted to have all the emails in your inbox that are older than five days deleted:
/usr/bin/archivemail --quiet --delete --days 5 /home/<USER>/mail/yourdomain.com/info/inbox
If you had an email account named info@yourdomain.com (info@yourdomain.com) and wanted to have all the emails in your sent-mail directory that are older than five days deleted:
/usr/bin/archivemail --quiet --delete --days 5 /home/<USER>/mail/yourdomain.com/info/sent-mail
Don't forget to change yourdomain.com to your actual domain name.
You can look in your mail directory either via your ftp client or the file manager to see where your mailboxes are located. If you have any questions about which command to use for which mailbox or anything else just ask here.
Step 1.
Login to your cpanel and click on the Cron jobs icon. Next click on the Advanced (Unix Style) button to open the cron manager.
Step 2.
Now let's say you want to have all the emails in your default email accounts inbox deleted that are older than 10 days and have it run at 1:30 AM each day.
To do this enter the following information in the following fields:
Minute: 30
Hour: 01
Day: *
Month: *
Weekday: *
Command: /usr/bin/archivemail --quiet --delete --days 10 /home/<USER>/mail/inbox
Make sure you replace <USER> with your actual cpanel username. So for example, if your username was cpanel, you would enter:
/usr/bin/archivemail --quiet --delete --days 10 /home/cpanel/mail/inbox
Step 3.
Hit the Commit Changes button and wait until sometime after 1:30 AM (assuming you set it up to run at that time) and login to your default email account to see if your emails have been deleted. If everything looks good your default inbox will now have any emails that are older than 10 days automatically deleted. To login into your default email account you use your cpanel username and password. That's all there is to it.
Miscellaneous notes and examples.
If you wanted to have all the emails in your default inbox deleted that are older than two days you would simply change the --days option to 2:
/usr/bin/archivemail --quiet --delete --days 2 /home/<USER>/mail/inbox
If you wanted to have all emails inside your mail directory including sent mail, spam, etc. that are older than 20 days deleted:
/usr/bin/archivemail --quiet --delete --days 2 /home/<USER>/mail/*
If you had an email account named info@yourdomain.com (info@yourdomain.com) and wanted to have all the emails in your inbox that are older than five days deleted:
/usr/bin/archivemail --quiet --delete --days 5 /home/<USER>/mail/yourdomain.com/info/inbox
If you had an email account named info@yourdomain.com (info@yourdomain.com) and wanted to have all the emails in your sent-mail directory that are older than five days deleted:
/usr/bin/archivemail --quiet --delete --days 5 /home/<USER>/mail/yourdomain.com/info/sent-mail
Don't forget to change yourdomain.com to your actual domain name.
You can look in your mail directory either via your ftp client or the file manager to see where your mailboxes are located. If you have any questions about which command to use for which mailbox or anything else just ask here.