Delete old emails
In order to delete emails over 6 months old, that are sat in an INBOX (and NOT in any other folders created by client) would somebody be kind enough to offer a php script?
I understand I can put this script in my public_html directory and call for it to run by a CRON command such as > /home/cPaneluser/public_html/yourscript.php
It would seem the easiest way for me as I can understand php, but not bash scripts or other suggestions I have read.
I apologise for being out of my depth reading other replies - but it appears also to me that they would delete ALL emails over 6 months old (for example) and not just those in a specified mailbox. Your patience appreciated!
-
Hi, If you want to perform this deletion activity through PHP, then you may end up enabling some PHP vulnerable function that is required to actually execute the removal command, in an attempt you may get in trouble with opening your server for attacks. Please be careful... A bash script would be perfect way for you to do this.. Hint: You can remove the mails from the "cur" folder that has the new and current emails.. 0 -
Hi, If you want to perform this deletion activity through PHP, then you may end up enabling some PHP vulnerable function that is required to actually execute the removal command, in an attempt you may get in trouble with opening your server for attacks. Please be careful... >> That sounds like good advice - thank you. A bash script would be perfect way for you to do this. Hint: You can remove the mails from the "cur" folder that has the new and current emails..
>> What do I actually do with a bash script - can it made to run automatically (via a cron job perhaps?)0 -
would somebody be kind enough to offer a php script?
Not sure why you'd need a script for this when it can be done from in your cPanel easy enough. cPanel > Email > Email Accounts > choose an email account you'd like to clean up by clicking the More menu to the right of the email account listed here, then select Manage Disk Usage. Click Manage to the right for some options. Will this fit your needs? 469150 -
That is absolutely perfect, thought I'd investigated everything on cPanel, many google searches, then got bogged down with similar threads using more esoteric stuff. Very grateful for your time! 0 -
Happy to help. :) 0 -
Not sure why you'd need a script for this when it can be done from in your cPanel easy enough. cPanel > Email > Email Accounts > choose an email account you'd like to clean up by clicking the More menu to the right of the email account listed here, then select Manage Disk Usage. Click Manage to the right for some options. Will this fit your needs? 46915
Hello I would like to know which command I can use to delete messages that are 6 months or older. And not from 1 year or more.0 -
I would like to know which command I can use to delete messages that are 6 months or older. And not from 1 year or more.
Hello, You can use the same option in cPanel: Email Disk Usage - Version 68 Documentation - cPanel Documentation Note the following under the "Remove Messages" section: Select custom query ... to customize your removal option. For more information, read Dovecot's0 -
i am using paper_lantern theme in cpanel and cant find any where to delete email form disk where is it please? 0 -
i am using paper_lantern theme in cpanel and cant find any where to delete email form disk where is it please?
As a reseller, you will need to check with your hosting provider to verify the Email Disk Usage feature is enabled and available for use. It's documented at: Email Disk Usage - Version 68 Documentation - cPanel Documentation Thank you.0
Please sign in to leave a comment.
Comments
9 comments