E. Kevin Zembower wrote, | I prefer a solution which says: | "X-Commands, if they appear in the body of a message, must be the first | line, and must be followed by a blank line before the rest of the body | of the message, or be the only thing in the message. If there's more | than one X-Command in the body, they must not be separated by a blank | line." Oh, you want to allow two or more X-Command: lines at the top of the body; I didn't realize that part. | Unfortunately, I don't know how to write the perl code for this. You don't need to. I've already posted a solution that doesn't use perl, but I'll modify it: :0B # password needs to come before line break * $ ^^X-Command:(.*\<)?$password { :0Bfw # brackets enclose caret, space, tab; note space left of ampersand * ^^(.+$)+[^ ] | sed -e '/^$/,$ b' -e '/^[^ ]*:/b' -e 's/^[^ ]/ &/' :0hfw | formail -X '' # two apostrophes with nothing between } Of course, if someone decides to send it multipart and the first thing in the body is MIME-wrapping instead of the sender's typed text, all bets are off.