NAME

mailtrim - Deletes old emails from the named unix mailbox file. Use at your own risk

SYNOPSIS

mailtrim [-d days] [-x] mailbox

ARGUMENTS and OPTIONS

mailbox is name of the mailbox file to be trimmed.

-d days : delete all messages more than days old, i.e.days is the maximum age, in days, of a message that will be allowed in the file

-d 0 will keep only today's messages

if omitted, -d 14 is assumed (delete messages more than 14 days old)

-x : if omitted discarded emails will be sent to STDOUT

DESCRIPTION

This script was written to empty old mail out the mailboxes of CUUG members who just never got around to doing tyhe job themselves. One user had over 250mb of mail in his shell account!

It has only been tested at CUUG, using our postfix mail server. You may need to make minor adjustments to make it work with your server... probably to the date format in the first line of each message

EXAMPLES

  1. delete everything more than a month old from joeuser's "mbox"
    and put the discarded old messages into a gzipped archive

    cd ~joeuser
    mailtrim -d 31 mbox | gzip > oldmail.gz

  2. delete everything but today's mail from joeuser's "mbox";
    don't show the discard messages

    cd ~joeuser
    mailtrim -d 0 -x mbox

REQUIRES

Perl 5, Getopt::Std

AUTHOR

Mike Babulic, http://www.cuug.ab.ca/~babulicm

COPYRIGHT

This program is distributed under the Perl Artistic License.

DOWNLOAD

mailtrim was last changed on June 29, 2004. You can find it on the author's website

gzip format :

http://www.cuug.ab.ca/~babulicm/perl/mailtrim/mailtrim.gz

zip format :

http://www.cuug.ab.ca/~babulicm/perl/mailtrim/mailtrim.zip