Hello Sean!
Thanks for the prompt response. Here's why I need to do this kind of
work (moving something from Cc to To while still letting the same thing
remain in the Cc field).
We have an integration with Salesforce.com (SFDC) and unfortunately,
there are some design issues with SFDC where it does not honor the email
headers to do the appropriate workflow processing within SFDC for a
given email.
The solution you proposed works for me. Thank you so much.
I am currently required to preserve the Cc but if I were to alter that
one too so that it no longer has the email address which was moved to
the To field, how do I achieve that? In other words, how do I remove an
address from the Cc field ?
Thanks and regards,
Komal
-----Original Message-----
From: procmail-bounces(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
[mailto:procmail-bounces(_at_)lists(_dot_)RWTH-Aachen(_dot_)de] On Behalf Of
Professional
Software Engineering
Sent: Friday, March 19, 2010 7:27 AM
To: procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
Subject: Re: How to find what matched in a given OR condition (I can't
use$MATCH)
At 17:45 2010-03-18 -0700, Komal Tagdiwala (ktagdiwa) wrote:
I have a requirement to check the Cc field for a given list of
addresses
which, if found, should be appended to the To: field.
Sillyness. Why?
Here s how my recipe currently works:
[snip]
I note that no effort is made to _remove_ the corresponding addresses
from
the Cc:.
| /opt/local/bin/formail -i "To: $TO; user1(_at_)someserver\(_dot_)com"
Why are you separating the addresses with a semicolon? You should be
using
a comma. The dot in the address needs escaping only when used in a
regular
expression.
Have you considered what will happen if there IS NO To: header (and thus
$TO is either empty, or set to a potential prior value, if you have a
large
procmailrc)?
The above recipe works just fine as long as I have a single Email
address
being searched for in the Cc field. However, if I were to extend this
recipe to check for more than 1 address in the Cc field, I don t know
how
to find out which address matched in the Cc condition in order to be
able
to add that specific matched address to the To field.
That's easy enough - so long as there's only ONE address. If you have
multiple addresses that may all be present together in various
combinations
(and perhaps with intervening addresses which are not of interest),
you're
going to need to beef up the processing. I'm not doing that for you
here.
Perhaps someone needs to ask "why does this address resassignment need
to
take place?"
Below is what I want to do.
*^(Cc):.*(\< user1(_at_)someserver\(_dot_)com|\<
user2(_at_)someserver\(_dot_)com|\<
user3(_at_)someserver\(_dot_)com|\< user4(_at_)someserver\(_dot_)com)
*^Cc:.*[ \<]\/(user1|user2|user3|user4)@example\.com
Lose the parens around Cc - while they don't break anything, they also
don't contribute anything to the expression.
I moved the leading space and bracket out to BEFORE the match operator.
I
also optimized the expression on the assumption that the domain was in
fact
consistent across all the usernames - if they're not, then longhand it
much
the way you did originally (but without bracket and space in each
address
grouping).
If there's a match, MATCH will be assigned a value like
"user1(_at_)example(_dot_)com"
(no quotes, no escaping).
You might benefit from following the link in my .sig and retrieving the
"sandbox" files I have published - it makes it very easy to throw a
series
of test messages at a filter and see what would happen, then tweak and
re-do.
I can t use the $MATCH variable since I can t use the RegEx operator \/
in
this scenario. Can I?
What would give you the impression that you cannot?
Question: How do I find out which of the above 4 addresses matched in
the
Cc condition?
By using MATCH.
---
Sean B. Straw / Professional Software Engineering
Procmail disclaimer:
<http://www.professional.org/procmail/disclaimer.html>
Please DO NOT carbon me on list replies. I'll get my copy from the
list.
____________________________________________________________
procmail mailing list Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
http://mailman.rwth-aachen.de/mailman/listinfo/procmail
____________________________________________________________
procmail mailing list Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
http://mailman.rwth-aachen.de/mailman/listinfo/procmail