procmail
[Top] [All Lists]

Re: How can I change a domain or extract only a username from ^TO

2005-06-03 08:06:26
On Fri, Jun 03, 2005 at 03:24:59PM +0200, Daniel Siechniewicz
wrote:

I get an email from name1(_at_)domain1(_dot_)com .

I want procmail to either extract just the "name1" part, or change
"domain1.com" to "domain2.com" without touching the "name1", then send
(forward) mail to name1(_at_)domain2(_dot_)com . And I want to avoid using an
external perl script :). 

Is the sender's address in a Return-Path header so that the
non-address comment doesn't have to be removed?

 :0
 * ^Return-Path:.*<\/(_dot_)*(_at_)domain1(_dot_)com>
 *  MATCH ?? ^^\/[^(_at_)]+
 ! $MATCH(_at_)domain2(_dot_)com

As ever, though, when using procmail to send mail out, you
should first append an X-Loop header, and of course be testing
for same on the way in:

 :0 fw h
 * ^Return-Path:.*<\/(_dot_)*(_at_)domain1(_dot_)com>
 *  MATCH ?? ^^\/[^(_at_)]+
 | formail -I "X-Loop: $MATCH(_at_)domain1(_dot_)com"

   :0 a  # implies A
 | ! $MATCH(_at_)domain2(_dot_)com

-- 
dman

____________________________________________________________
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