Hmm...
I'm interested in updating the FAQ, but the code seems to be a bit crazy yet. (Ironically, the word-wrapping doesn't help. ;-)
Now, I could be way off on this one, so don't go jumping up to place this into production; there are some dark corners to this stuff that I'm sure I don't know about!
If the goal here is to pick out and unwrap text from a message and inject that text as a header using perl, then I'm thinking this might be saner:
--- cut here --- # Allow embedding a single X-Command on multiple lines # within the body of an email. (Lines will be joined.) # Look for FIRST magic X_CMD: token. If found, # take from there to __END and add to message header. # Like this: X_CMD: X-Command: blah blah blah __END # (X-Command: blah blah blah..) can be across multiple lines... # Note that this is kind of expensive, but X-Commands should # be somewhat rare. :0 Bw * X_CMD: * __END { XCMD=`perl -p -0077 -e \ 's/[\n\r\s]+/ /sg; \ s/^.*?X_CMD:\s*(.*?)\s*__END.*/$1/;'`
:0 f |formail -i "$XCMD" } # End of recipe --- cut here ---
Please let me know if I'm out to lunch on this one.
Check out the SmartList FAQ at http://www.hartzler.net/smartlist/
Regards,
Pete.