procmail
[Top] [All Lists]

Re: forward to other domain

1997-11-03 17:33:11
"Tomas Karlsson" <webmaster(_at_)iimagers(_dot_)com> writes:
Can anyone tell me how to make procmail to fetch a username in the to 
field (like in username(_at_)domain1(_dot_)com) and forward the email to 
another domain but with the same username, such as 
username(_at_)domain2(_dot_)com?

This depends completely on how procmail is being invoked.  If procmail is
being invoked via the sendmail mailertable, then the envelope recipient
address can be found in $2 ($1 contains the envelope sender address):

        from = $1
        rcpt = $2

        :0
        * rcpt ^^\/[^(_at_)]+
        ! -f "$from" "$MATCH(_at_)domain2(_dot_)com

Note: you need procmail 3.11pre or later: 3.10 has a bug in it's handling
of arguments when in mailfilter (-m) mode.

Philip Guenther

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