Eugene Alperovich wrote:
Hey everyone, Does anyone know if I can use procmail/formail to remove
old mail from users mailbox on a Linux machine? What I want to have
(eventually) is a cron-ran script that each day checks all the
mailboxes (around a 100) and removes any mail older than a week.The
idea behind this, is that this server works as a backup -so it's only
used if the main server dies.For the record, I am using sendmail
8.11.2 and ipop3d on a RH 7.1 linux . Thanks in advance,Eugene
I use formail to trim some mailboxes based on number of messages ($1 =
mailbox, msg_skip is no of messages to leave in mailbox):
touch $TMP_MBX
cat $1 | formail +${msg_skip} -nbfY \
-s formail -bfYI "X-MBX-Trim: $trim_date" >> $TMP_MBX
rm $1
mv $TMP_MBX $1
Mike