[nflug] For the command line wizards

Mark Musone mmusone at shatterit.com
Mon Nov 20 15:01:23 EST 2006


Perl's mail cpan modules (mailtools being most likely the one to use, maybe
Mail-Box too)
Can be found at:
http://www.cpan.org/modules/by-category/19_Mail_and_Usenet_News/Mail/


This would be very easy to script in perl. Open up the mailbox, loop
through, deleting all mail older than X days.

It should be like 10 lines of perl.

use Mail::Box::Manager;
 my $mgr    = Mail::Box::Manager->new;
 my $folder = $mgr->open(folder => $ENV{MAIL}, ...);
  $num=$folder->nrMessages();

for($x=1;$x<=$num;$x++)
	{
	$msg=$folder->message($x);
	if($msg->timestamp < localtime()-(7*24*60*60))
	$msg->delete();
	}




...something like that..don't quote me..just made it up..

You can also maybe call: 

$obj->scanForMessages(MESSAGE, MESSAGE-IDS, TIMESPAN, WINDOW)

In which you can simply return a list of all messages based on the
timestamp..i just don't trust it as much...

Mark

-----Original Message-----
From: nflug-bounces at nflug.org [mailto:nflug-bounces at nflug.org] On Behalf Of
Cyber Source
Sent: Monday, November 20, 2006 2:45 PM
To: nflug at nflug.org
Subject: [nflug] For the command line wizards

Ok guys, I got one for the wizards of command line.
I have an email server running spamassassin, which is a very good thing.
Spamassassin catches much much crapola, another good thing. It
occasionally makes a mistake on valid emails and puts them in 2 folders
depending on severity, .probably-spam and .almost-certainly-spam along
with actual spam based on previously black holed IP, html format, etc..
It does a very good job and rarely makes a mistake. Initially when
putting this in, I came up with the idea that we had better whack those
2 folders on a weekly basis because if people don't subscribe to these
folders and check them or delete the emails in them, they could get
huge, and in a hurry. So, I just setup a cron to weekly whack these
folders, all has been well. But now I would like to give the emails that
come in on the 7th day, the same chance that the emails got which came
in on the 1st day, that being 6 more days to check the folder to see if
it is actually spam and not a mistake. So my question is this....
How can I setup a cron or script to be run by cron that could be run
daily and delete the emails in these folders that are at least 7 days
old? This way, if someone does get a valid email put in the spam
folders, they would have at least 7 days to go check. Also, something to
keep in mind that people often put wrong dates, etc., so it would
actually read the time/date that the email arrived.
I envision lots of curlys and dashes and dollar signs here....{'}$-@???
TIA
_______________________________________________
nflug mailing list
nflug at nflug.org
http://www.nflug.org/mailman/listinfo/nflug

_______________________________________________
nflug mailing list
nflug at nflug.org
http://www.nflug.org/mailman/listinfo/nflug



More information about the nflug mailing list