procmail
[Top] [All Lists]

Re: advice needed on recipe

2007-09-21 11:48:32
In message 
<20070921184154(_dot_)308c1ca1(_dot_)rkimber(_at_)ntlworld(_dot_)com>, R Kimber 
wrote:
On Fri, 21 Sep 2007 15:46:08 +0100
N.J. Mann wrote:

Try the following (I did try it!).  You may need to alter the regexp
because you didn't actually give us an example and so I assumed the
minimum, e.g. name(_at_)fqdn(_dot_)

:0 B
* your_email:\ \/.*
{
    NEW_FROM=$MATCH

    :0 fhw
    | formail -I"From: $NEW_FROM"

    :0:
    where_I_want_my_rewritten_mail
}

Brilliant.  Many thanks indeed. It works fine.

One further question, if I may, for educational purposes:  if I were to
have two conditions, both of which must be met, which one would $MATCH
represent? The second? (I was thinking of filtering on subject first,
in case other emails contained 'your_email')

Yes, you can combine the two, but it may make more sense, i.e. be more
readable to you in twelve months time, if you use separate ones.  The
combined solution would be:

:0 BH
* ^Subject:\ put_your_subject_regexp_here
* your_email:\ \/.*
{
    NEW_FROM=$MATCH

    :0 fhw
    | formail -I"From: $NEW_FROM"

    :0:
    where_I_want_my_rewritten_mail
}

Note the change from :0 B to :0 BH.


Cheers,
       Nick.

PS  Please respect my setting of the Mail-followup-to: header and keep
    the discussion on the list.  Thanks.
-- 
____________________________________________________________
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>