procmail
[Top] [All Lists]

Re: Copy field to another with formail

2000-02-09 04:32:03
On Wed, 9 Feb 2000 00:28:44 -0800 (PST), tomers(_at_)excite(_dot_)com wrote:
I have 2 headers that (From and Sender) that are different. As a
result Outlook writes: "From: x On behalf of y" (when x is Sender
and y is From). I figured that if I change the x to y too, it'll be
ok. I know that -R renames the field. How do I copy a field?

Wouldn't it be simpler to just remove Sender: if you don't want to see
it?

Actually, can I change the 'sender' field? (after the formail command i use
! to send it)

This will copy From: to Sender: -- that is the most complicated of the
cases, so you should (hopefully) be able to construct the others from
this. 


    # If there is a Sender: grab it and copy to From:
    #  copy that into Sender:
    # The f flag means modify this message instead of deliver it somewhere
    :0fhw
    * ^Sender:[ ]\/[^   ].*
    | formail -I "From: $MATCH"

    # Now send off the message, regardless of whether it was changed
    :0
    ! elsewhere(_at_)example(_dot_)com

The whitespace between the brackets consists of a space and a tab, in
any order.

To merely zap Sender: you can say formail -I "Sender:" without a value
after the colon (whereas formail -I "Sender: foo" will add a Sender
field).

Hope this helps,

/* era */

-- 
 Too much to say to fit into this .signature anyway: <http://www.iki.fi/era/>
  Fight spam in Europe: <http://www.euro.cauce.org/> * Sign the EU petition

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