procmail
[Top] [All Lists]

Re: advice needed on recipe

2007-09-21 07:47:08
In message 
<20070921150756(_dot_)6b663f0c(_dot_)rkimber(_at_)ntlworld(_dot_)com>, R Kimber 
wrote:
I'm trying to rewrite the 'From' field of received messages with
something else, but have been unable to get it working.

First off a word of warning: there is a From: header and a From_ header.
The underscore in the latter is used in discussions to indicate the lack
of the colon.

I assume you wish to re-write the From: header.

The problem is that I am unable to reply directly to messages I receive
via my website because the 'From' filed is mangled when it reaches me,
but the correct 'From' address is in the body of the email.  I can
retrieve it at the command line with:-

`grep -m1 'your_email: ' <email message> | cut -d\  -f2`

so I assumed I could do
EADDRESS=`grep -m1 'your_email: ' | cut -d\  -f2`

Yuck.  No need to use grep.

But, after much experimentation, I don't seem to be able to do
something like

|/usr/bin/formail -i "From: $EADDRESS"

What would be the form of a recipe for this?  Or am I trying to do
something impossible?

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
}


Cheers,
       Nick.
-- 
____________________________________________________________
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>