I'm sure there's a much easier way, but this will work: :0 * ^Subject: linebuf | ( formail -zr ; echo "$LINEBUF" ; ) | $SENDMAIL -oi