How do I automatically delete old emails on CPanel ?

HOW-TO Have your old email automatically deleted

If you have a mailbox that is always going over-quota or 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.

  1. Login to your cpanel and click on the Cron jobs icon
  2. Next click on the Advanced (Unix Style) button to open the cron manager.
  3. 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 6:45 AM each day. 

    To do this enter the following information in the following fields: 
    Minute: 45 
    Hour: 06 
    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.
  4. Hit the Commit Changes button and wait until sometime after 6:45 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

If you wanted to have all the emails deleted that are older than three days you would simply change the --days option to 3

If you wanted to have all emails inside your mail directory including sent mail, spam, etc. that are older than 30 days deleted... 
/usr/bin/archivemail --quiet --delete --days 30 /home/{USER}/mail/*

If you had an email account named info @ yourdomain.co.uk and wanted to have all the emails in that inbox that are older than seven days deleted... 
/usr/bin/archivemail --quiet --delete --days 7 /home/{USER}/mail/{yourdomain.co.uk}/info/inbox

If you had an email account named info @ yourdomain.co.uk and wanted to have all the emails in your sent-mail folder that are older than twenty-one days deleted... 
/usr/bin/archivemail --quiet --delete --days 21 /home/{USER}/mail/{yourdomain.co.uk}/info/sent-mail

Don't forget to change {yourdomain.co.uk} to your actual domain name !

You can look in your mail directory via your ftp client or the online file manager to see where your mailboxes are located.

PLEASE NOTE: We *CANNOT* recover mail deleted in this manner, so please use this tutorial at your own risk

  • 0 کاربر این را مفید یافتند
آیا این پاسخ به شما کمک کرد؟

مقالات مربوطه

Where is the Form Mail (FormMail) Script ? How to use CPanel inbuilt form to email scripts ?

Included with every Astutium::Host CPanel web hosting plan is the free Form Mail CGI Script,...

How do I set up an Autoresponder/Out of office to incoming emails on CPanel ?

Creating an Autoresponder Login to your webmail interface through http://{domain}/webmail Go...

How do I setup GMail and Plesk ? How to use Plesk and an External Mail Server ...

How to setup Plesk and an External Mail Server Although your hosting account can handle your...

Outlook Error 0x800CCC80 when sending email.. Unable to send email - no connection to mailserver on port 25.

The connection to the server has failed. Account: '', Server: 'mail.mydomain.com', Protocol:...

Change SMTP port in Outlook Express

Change SMTP port in Outlook Express...

Powered by WHMCompleteSolution