procmail
[Top] [All Lists]

Re: Mail forwarding with regex

2010-03-05 13:11:52
On Fri, 5 Mar 2010, LuKreme wrote:
First off, procmail is not an MTA. this *will* cause problems.

+1

Something like this (untested) should work, or at least get you in the right direction

Given the tendency for various mail clients to use almost anything for a 'To' header, including multiple recipients, mailing list addresses, etc, the OP's best bet is to find the header inserted by the MTA for the actual recipient of that e-mail. In my postfix, the header is "Delivered-To:".

Keep in mind that mail forwarded internally may have multiple Delivered-To headers, but ignoring that case, it should be as simple as:

: 0
* ^Delivered-To: (_dot_)*\(_at_)example(_dot_)com
* ^Delivered-To: \/[^\(_at_)]+
! $MATCH(_at_)example(_dot_)net

- Charles
____________________________________________________________
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>