--- /notifications/notifications_mail2web/notifications_mail2web.module
+++ notifications_mail2web.module
@@ -151,6 +151,8 @@
       $info += array('glue' => "\n");
       $message['body']['#prefix'] = implode($info['glue'], $prefix);
     }
+    //this is a dirty solution to crappy webmail clients that strip out the messageid and in-reply-to headers, got a better way? show me, please.
+    $message['body']['#footer'] .= t(' MessageID='.$message['params']['mail']['headers']['Message-ID']);
     
   }
 }
@@ -160,6 +162,9 @@
  */
 function notifications_mail2web_mailhandler($node, $result, $i, $header, $mailbox) {
   // The In-reply-to header is cleaned and passed in $node->threading
+  if (!$node->threading) { 
+    $node->threading=notifications_mail2web_get_backup_messageid($node->body);
+    }
   if ($node->threading && ($params = notifications_mail2web_check_messageparams($node->threading, $header)) && empty($params['error'])) {
     // Now check user id , just go ahead if they match and it is a valid user
     if ($node->uid && $node->uid == $params['uid']) {
@@ -169,7 +174,7 @@
       $node->type = 'comment';
       $node->nid = $params['nid'];
       $node->pid = $params['cid'];
-      
+      $mimeparts=$node->mimeparts;
       // Now trim out the resf of the message if separator text exists
       // @ TODO May fail for html mails
       if ($marker = variable_get('mail2web_reply_text', t('((( Reply ABOVE this LINE to POST a COMMENT )))'))) {
@@ -177,9 +182,32 @@
         $pos = strpos($node->body, $marker);
         if ($pos !== FALSE) {
           $node->body = substr($node->body, 0, $pos);
-          // Something specifically for mac mail clients out there
-          $split = preg_split("/On [A-Z][a-z]{2} [0-9]{1,2}, [0-9]{4}, at [0-9]{1,2}:[0-9]{2} [AP]M, [a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4} wrote/",$node->body);
-          $split = preg_split("/\>/",$split[0]);
+          
+          if ($mimeparts[1]) {
+            //if there is a second mimepart, its html, am I wrong...
+            //check for html body
+            $node->body=notifications_mail2web_clean_html_message_body($node->body);
+            //this expression is messed up because of html email in the on.. wrote...
+            $split = preg_split('/<div>On/', $node->body);	
+            //$node->body = preg_replace('/On [A-Z][a-z]{2} [0-9]{1,2}, [0-9]{4}, at [0-9]{1,2}:[0-9]{2} [AP]M, <a href\=\"mailto\:[a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}">[a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}</a> wrote/','', $node->body);
+            $node->body = $split[0];
+            
+          } else {
+            //the old way that seems to work for plain text
+            // Something specifically for mac mail clients out there
+            $split = preg_split("/On [A-Z][a-z]{2} [0-9]{1,2}, [0-9]{4}, at [0-9]{1,2}:[0-9]{2} [AP]M, [a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4} wrote/",$node->body);
+            $split = preg_split("/\>/",$split[0]);
+            $node->body = $split[0];
+            
+          }
+          //for the old school webmail
+          $split = preg_split("/Original Message/",$node->body);
+          $node->body = $split[0];
+          //for gmail
+          $split = preg_split("/\<div class\=\"gmail_quote\"\>On/",$node->body);
+          $node->body = $split[0];
+          //for old yahoo
+          $split = preg_split("/\<br\>\-\-\- On/",$node->body);
           $node->body = $split[0];
         }
       }
@@ -200,6 +228,33 @@
 }
 
 /**
+ * Find the message id in the body if yahoo was arrogant enough to strip it out of the headers.
+ * 
+ * yahoo is out to destroy all that is not yahoo groups.
+ *  
+ * @param $body
+ *   raw email body
+ *
+ */
+function notifications_mail2web_get_backup_messageid($body) {
+  $res = preg_match_all(
+        "/[a-z0-9]+([_\\.-][a-z0-9]+)*@([a-z0-9]+([\.-][a-z0-9]+)*)+\\.[a-z]{2,}/i",
+        $body,
+        $matches
+      );
+
+      if ($res) {
+        foreach(array_unique($matches[0]) as $email) {
+          if (ereg(variable_get('mail2web_server_string', 'example.com'), $email)) {
+            $backup_messageid=$email;
+          }
+         }
+      }
+      print 'backup'. $backup_messageid;
+ return $backup_messageid;     
+ }     
+
+/**
  * Handle errors and bounce mail when authentication or validation fail
  * 
  * We handle the incoming email carefully and don't add any user data in the response
@@ -353,3 +408,62 @@
   return md5(implode('-', $params));
 }
 
+/** This function is ripped straight out of og2list. god bless the work that has gone into this.
+ * Clean HTML Content-type: text/html message bodies.
+ * There are 2 main tasks performed.  First we remove any extra linefeeds
+ * from the body, placing it all on one line.  This is because Drupal will
+ * start inserting linefeeds in the post at the end of each HTML line. 
+ * the length of these lines is determined by the email client as it writes
+ * out the HTML and has nothing to do with the line or paragraph breaks 
+ * in the post itself.
+ * Finally, there is the Outlook babysitting.  Predictably, Outlook produces
+ * mangled HTML which ends up showing up in the Drupal message body.  We do some
+ * cleanup of the body's HTML at the end to make sure none of this affects the final
+ * post content.
+*/
+function notifications_mail2web_clean_html_message_body($body) {
+   
+	$body = preg_replace('/[\r\n]{2,}/','ABCD_PLACEHOLDER_DCBA', $body);  // save para breaks
+	$body = preg_replace('/[\r\n]+/',' ', $body);          
+	$body = str_replace('ABCD_PLACEHOLDER_DCBA',"\n\n",$body);  // put the para breaks back in
+	
+	// MS-Outlook HTML cleanup:
+	// Stylesheet commenting:
+	// Outlook's initial <style> definitions are not properly wrapped in a comment, the comment that is
+	// there gets stripped by drupal and style definitions show up in the message body!	    
+	// the offending source is:
+	// <!--[if !mso]>
+	// <style>
+	//   [...]
+	// </style>
+	// <![endif]-->
+	// we fix this to have the comment inside the <style> tag and no strange MS comments.
+	$body = preg_replace('/<!--\[if !mso\]>.*?<style>(.*?)<\/style>.*?<!\[endif\]-->/i', '<style><!-- $1 --><\/style>', $body);
+	
+	// Bizarro unescaped XML engine code:
+	// Now we get rid of bizarre code inside mso/<xml> tags, 
+	// which Outlook puts in to accompany each embedded image, and
+	// which once again has exposed text that end up in the post.  Thanks, Bill!
+	// <!--[if gte mso 9]><xml>
+	//  <o:OLEObject Type="Embed" ProgID="Photoshop.Image.8" ShapeID="_x0000_i1027" 
+	//   DrawAspect="Content" ObjectID="_1234038827">
+	//   <o:WordFieldCodes>\s</o:WordFieldCodes>      <<<< the \s shows up in the post!!!!  
+	//  </o:OLEObject>
+	// </xml><![endif]-->
+	// This stuff is SO ridiculous we are just going to remove it entirely!
+	$body = preg_replace('/<!--\[if gte mso.*?\]>.*?<xml>.*?<\/xml>.*?<!\[endif\]-->/i','', $body);
+	
+    //watchdog('og2html4',"Body after cleaning: [$body]");
+    // Sometimes check markup still leave the <!DOCTYPE ... > header... remove if present.
+    $body = preg_replace('/<!.*?DOCTYPE.*?>/i','',$body);
+    //watchdog('og2html5',"Body after cleaning: [$body]");
+  
+    // finally run check_markup with the HTML input format.  This will clean the mail
+    // so that Drupal can display it properly, removing extra HTML we don't need.
+    //watchdog('og2html2',"Format is: $format, body before check_markup: [$body]");
+    $format = variable_get('messaging_default_filter', '');
+    $body = check_markup($body, $format, FALSE);
+    //watchdog('og2html3',"Body after cleaning: [$body]");
+    
+    return $body;
+}
