procmail
[Top] [All Lists]

Re: Mail forwarding with regex

2010-03-05 12:40:57
On 05-Mar-10 06:52, Patrick Plattes wrote:
hello list :-),

i'm new here and i'm really not a guru of procmail, so i hope its not
a boring question to you i want to ask. i have two domains foo.net and
bar.net. now i wan't to map A to B. So everything to user(_at_)foo(_dot_)net
should be forwarded to user(_at_)bar(_dot_)net(_dot_)

First off, procmail is not an MTA. this *will* cause problems.

:0H
* ^TO(.*)@foo.net
! $1(_at_)bar(_dot_)net

$1 is the first argument from the commandline invocation, it is not what you want. Something like this (untested) should work, or at least get you in the right direction

WS="       " #space and tab

        :0
        * $ ^To:[$WS]+\/[^$WS].*
        { TO=$MATCH }

        :0
        * TO ?? ^\/[^(_at_)]+
        { TO_USER=$MATCH }

        :0
        * TO ?? example\.com
        ! $TO_USER(_at_)example(_dot_)net


--
I WILL NOT GET VERY FAR WITH THIS ATTITUDE
        Bart chalkboard Ep. 7F12
____________________________________________________________
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>