procmail
[Top] [All Lists]

Re: Full header with the reply

1998-02-08 12:18:13
Hermann Wecke asked,

| What is the flag (or command) to also include (copy) the header with the
| automatic reply?

The answer to that question won't solve Hermann's problem.  formail -rbk
changes the head but not the body, so changing the flags won't make a
difference.

If you want to include the head when you send back the body, you need two
copies of the head: one to invert with formail -r[t] and one to remain in
the body.  One way to do that is like this:

  :0hfwr
  | sed -e H -e '$ G'

Now the message will look like this:

original head
blank line
duplicate head  \
blank line       > new body
original body   /

which is to say, its body will now consist of a copy of the head, a blank
line, and then the original body.  When formail -r inverts the head in a
later recipe, the duplicate head that is now in the body will be treated
as part of the body (because that's what it is).

It does require that the entire head fit into sed's hold space, but it almost
always will; exceptions are cases where the sender messed around and added a
bunch of uninformative (and usually self-congratulatory) additional headers
or when the message got caught in a loop for a while but finally escaped
before being bounced for too many hops.

You may need to tweak some things so that the duplicate of the From_ line
ends up with only one ">" and not two.

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