procmail
[Top] [All Lists]

Removing an address from To & Cc headers.

2010-01-12 09:15:49
I have this:

:0
* ^TO(testipelle|kestipelle|toberemoved)
{
        ORIGTO=`formail -c -xTo:`
        ORIGCC=`formail -c -XCc:`

        :0fhw
        | formail -I "To: pelletesti(_at_)some(_dot_)com" -I "Cc: $ORIGTO, 
$ORIGCC"
}

:0
* ^TOpelletesti(_at_)some(_dot_)com
! realman(_at_)some(_dot_)com


It does what it is supposed to do. If matching, it will move all
recipient addresses to the Cc: header, add a new To header and send it
to realman(_at_)some(_dot_)com(_dot_)


But this is not enough. What I need now is a way to do the same as
above, but also remove all "toberemoved(_at_)some(_dot_)com" email-addresses 
both
from TO and Cc headers.

The problem is of course, that the "toberemoved(_at_)some(_dot_)com" address 
could
show in many different ways: "To Be Removed" <toberemoved(_at_)some(_dot_)com> 
or
toberemoved(_at_)some(_dot_)com (To Be removed) or whatever.

And there could also be several recipients in both the To and the
Cc-headers which shouldn't be removed but all added to the Cc-header.
Additionally it shouldn't break the Cc -header syntax.

I have tried to figure out how to use Mail::Address or Email::Address
packages on perl to accomplish this, but I just not get it. :-( 

I did a lot of googling and searching through this list, but seems no
one has tried to do this before.






-- 
*** tonyk(_at_)iki(_dot_)fi ***
* Tony K Lindström *
 ******************


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________
____________________________________________________________
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

<Prev in Thread] Current Thread [Next in Thread>