Problem with forwarding in procmail

Problem with forwarding in procmail

am 29.07.2005 18:31:11 von Gregory Haynes

Hi,

I wrote the following script to change the To field of the incoming emails
so that once forwarded the original recipient would be clear.
#!/bin/sh
read INPUT_STRING
while [ "$INPUT_STRING" != "" ]; do
if [ `echo "$INPUT_STRING" | cut -c1-3 | tr "[:lower:]" "[:upper:]"`
= "TO:" ]; then
INPUT_STRING="To: {New email address}"
fi
echo "$INPUT_STRING"
read INPUT_STRING
done
exit 0

The following procmail recipes should run the script then forward the
modified message to an address and keep a copy with the original recipient.
:0 fhw
| script

:0 c
! {Email address to forward to}

:0
$DEFAULT

The copy with the original recipient comes through fine, however the
forwarded message has the header in the message body (minus the first line)
and a new basic header.

Any idea what's going wrong here?

Thanks.

Gregory Haynes