Auto delete mails from postfix server after 1 month
How do I make my postfix mail server auto delete mails from user mailboxes after say 1 or 2 months?
|
Hi Oduori,
I would suggest that you could do this with a cron job. cron is a program which can run other programs periodically. You could write a very short shell script which finds files (those files being mail messages you want to delete) which are older than 1 month and then delete them. You can then run the shell script every day as a cron job for user root. This will delete files older than 30 days old Code:
find /path/to/mailmsgs -mtime +30 -delete Put this code in a scripts file, let's call it rm_old_mail.sh Using crontab -e you can create a cron job for user root. Just google crontab examples to get some information on how to use cron. Then you would run the rm_old_mail.sh script everyday at 1am, for example. |
All times are GMT -5. The time now is 04:59 PM. |