--- mailhandler/mailhandler.retrieve.inc 2009-05-12 14:14:39.000000000 +0800 +++ knowledge_base/sites/all/modules/mailhandler/mailhandler.retrieve.inc 2009-10-30 13:41:39.770937619 +0800 @@ -268,13 +268,19 @@ function mailhandler_process_message($he // Process the commands and the body $lines = explode("\n", $body); + $cmd_lines = array(); //stores the command line number + for ($i = 0; $i < count($lines); $i++) { $line = trim($lines[$i]); + $line = strip_tags($line); $words = explode(' ', $line); // Look for a command line. if not present, note which line number is the boundary if (substr($words[0], -1) == ':' && !isset($endcommands)) { + if (!isset($startcommands)) + $startcommands = $i; + $cmd_lines[] = $i; // Looks like a name: value pair $data = explode(': ', $line, 2); @@ -316,7 +322,8 @@ function mailhandler_process_message($he } } else { - if (!isset($endcommands)) $endcommands = $i; + if (isset($startcommands)) + if (!isset($endcommands)) $endcommands = $i; } // Stop when we encounter the sig. we'll discard all remaining text. @@ -327,7 +334,11 @@ function mailhandler_process_message($he } // Isolate the body from the commands and the sig - $tmp = array_slice($lines, $endcommands, $i - $endcommands); + //$tmp = array_slice($lines, $endcommands, $i - $endcommands); + $tmp = $lines; + foreach ($cmd_lines as $value) { + unset($tmp[$value]); + } // flatten and assign the body to node object. note that filter() is called within node_save() [tested with blog post] $node->body = implode("\n", $tmp);