Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 06-21-2010, 03:36 AM   #1
LQ Newbie
Registered: Jun 2010
Distribution: Centos/Fedora
Posts: 1

Rep: Reputation: 0
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?
Old 07-18-2010, 08:50 AM   #2
LQ Newbie
Registered: Jan 2008
Location: Eastern Australia
Distribution: Mint 6, 7, Ubuntu 9.04
Posts: 18

Rep: Reputation: 1
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

find /path/to/mailmsgs -mtime +30 -delete
*BEWARE* - test this code on unimportant files first, otherwise you can get a nasty shock and lose files.

Put this code in a scripts file, let's call it

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 script everyday at 1am, for example.


auto, delete

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
move mails on exim server to postfix server weda Linux - Server 1 01-13-2010 03:12 AM
To restrict a user to send mails only to 3 e-mails IDs using postfix mail server sharath41 Linux - Newbie 2 07-21-2008 08:38 PM
auto delete old mails in sendmail - Pls Help maharajg Linux - Networking 3 11-10-2004 12:21 PM
move postfix mails from server to another postfix server onetwo Linux - Software 2 03-18-2003 03:22 PM
How do I auto delete mails from a specific domains/users? markng Linux - Security 4 05-02-2002 11:41 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:37 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration