If I was smart, I'd make it a daemon with a c-written lightweight client. Bah, I'm not annoyed enough yet. :)
use File::Temp; use Mail::Internet; use strict; my $folderList = undef; open( $folderList, ".folderFilter" ); my @folders = <$folderList>; my @mail = <>; my $message = Mail::Internet->new( \@mail ); my $mailFrom = $message->head->get("From"); # The RFC says one thing, but sometimes, people leave it out. $mailFrom = $1 if( $mailFrom =~ /<(.*?)>/ ); foreach my $folder ( @folders ) { my( $folder, $from ) = split( /\|/, $folder ); if( $from =~ /\Q$mailFrom\E/ ) { writeMail( "Maildir/$folder/new" ); exit( 0 ); } } writeMail( "Maildir/.unrecognized/new" ); sub writeMail { my $folder = shift; my $timestamp = time(); my $fileHandle = new File::Temp( TEMPLATE => "$timestamp.XXXXXX", +DIR=> $fol der, UNLINK => 0 ); $message->print( $fileHandle ); close( $fileHandle ); }
----
Give me strength for today..
I will not talk it away..
Just for a moment..
It will burn through the clouds..
and shine down on me.
|
|---|