Mail redirect by size?

One of my email accounts is on an IRIX server.  I use fetchmail to retrieve my mail from this server over a dialup connection.  Is there a way that I can set up the server so that messages over a certain size are automatically redirected to another email address? (Like a .forward file that only applies to certain messages)
ZeePrimeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

den_tsopaCommented:
i think the only way to do this is to set up .forward file in your home dir to:
"|parse_prog"
and parse_prog will be a script like this:
#!/usr/bin/perl

$letter=<STDIN>;
if (length $letter > 1000) # e.g.
{ open(HANDLE,"| mail ANOTHER_ADDRESS")||die; }
else
{ open(HANDLE,"| LOCAL_FOLDER")||die; }
print HANDLE $letter;
close HANDLE;
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ozoCommented:
$letter=<STDIN>;  #just reads the first line
#you probably wanted something like:
$letter=join'',<STDIN>;
0
den_tsopaCommented:
well, of course you're right, ozo, thanx
0
den_tsopaCommented:
corrected parse_prog:

#!/usr/bin/perl

$LOCAL_FOLDER="/var/mail/user";
$BIGLETTER_ADDR="bigletter@user.email";
$BIGSIZE=1000;

$letter=join "",<STDIN>;
if (length $letter > $BIGSIZE)
{ open(HANDLE,"| mail $BIGLETTER_ADDR")|| die "cannot pipe: $!\n"; }
else
{ open(HANDLE,">> $LOCAL_FOLDER")||die "cannot open local folder: $!\n"; }
print HANDLE $letter;
close HANDLE;
0
ZeePrimeAuthor Commented:
Thanks for the great answer, den_tsopa.  Sorry it took me so long to get you your points - I was on vacation for a month.

Z'
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.