procmail
[Top] [All Lists]

Re: copying head into body

1996-09-06 22:56:16
robert(_at_)elastica(_dot_)com asked,

| I want access to the entire header block from the rule pipe that's building
| the body of message... How I get the header block. I want to include
| the headers in the body.. I'll probably need to quote them too.

The simplest way is to double-print the entire head, including the blank line
at the end.  Thereafter procmail will see the blank line at the end of the
first set of headers and take the second copy as part of the body.  If the
head is short enough to fit into $LINEBUF, this might work (it is untested):

 :0fwh
 * any appropriate conditions
 * H ?? ^^\/(.|$)^^
 | echo "$MATCH" ; echo "$MATCH"

but I'd feel a little safer with this (provided that the head fits within
sed's hold space):

 :0fwh
 * any appropriate conditions
 | sed -e 1h -e '1!H' -e '$!b' -e p -e x

Finally, if the head is sometimes too big for sed's hold space, we can resort
to using a temporary file:

 :0hfw:.headhold.lock
 | tee .headhold ; cat .headhold

If you want to indent the copy in the body or insert citation characters
in front of them, replace cat with whatever it takes (such as sed) to make
those changes.

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