Eugene Geldenhuys wrote:
I have looked at the FAQ and scoured the web for a recipe to
perform the function I require.
Your problem can't be solved with a simple recipe.
The closest I got was the following:
# Procmail recipe file to sort incoming mail to individual mailboxes
#
:0:
* ^TO_\/(.*)@
* MATCH ?? ()\/[^(_at_)]+
# | sed -e 's/[^a-z0-9_-]//g'
$MATCH
Ouch! This won't work too well on messages like this one:
From: Eugene Geldenhuys <eugeneg(_at_)tfx(_dot_)com(_dot_)au>
Subject: Using Procmail and Fetchmail ...
To: procmail(_at_)informatik(_dot_)RWTH-Aachen(_dot_)de
Reply-To: eugeneg(_at_)tfx(_dot_)com(_dot_)au
MIME-version: 1.0
X-Mailer: Pegasus Mail for Win32 (v3.11)
Is the first email address on the first line matching ^TO_ guaranteed
to be the one and only address where the message should be filed?
i.e., are you guaranteed never to get a message like:
To: sam(_at_)yourdomain, george(_at_)yourdomain
cc: donna(_at_)yourdomain
where you want to put one copy in each of sam's, george's, and donna's
mailboxes?
If you're able to guarantee this, then here's a possible modification
of your recipe. It's not the most elegant or efficient but it lets
formail(1) canonicalize the address.
:0
* ^TO_\/(.*)@
* MATCH ?? ()\/[^(_at_)]+
{
R=$MATCH
:0 hwi
MB=| (</dev/null formail -f "-iFrom: $R" | formail -rtzxto: )
}
:0
$MB
The above is UNTESTED, etc.
--
Neither I nor my employer will accept any liability for any problems
or consequential loss caused by relying on this information. Sorry.
Collin Park Not a statement of my employer.
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail