diff --git a/include/class.mailfetch.php b/include/class.mailfetch.php
index 07a3aa27fc46db8fe6644f7926f29c11822404cf..fababa054d5d847234487fa64a8dab1752a7ee06 100644
--- a/include/class.mailfetch.php
+++ b/include/class.mailfetch.php
@@ -418,23 +418,24 @@ class MailFetcher {
     function getBody($mid) {
         global $cfg;
 
-        if ($body = $this->getPart($mid,'TEXT/HTML', $this->charset)) {
-            //Convert tags of interest before we striptags
-            //$body=str_replace("</DIV><DIV>", "\n", $body);
-            //$body=str_replace(array("<br>", "<br />", "<BR>", "<BR />"), "\n", $body);
-            $body=Format::safe_html($body); //Balance html tags & neutralize unsafe tags.
-            if (!$cfg->isHtmlThreadEnabled())
-                $body = convert_html_to_text($body);
+        if ($cfg->isHtmlThreadEnabled()) {
+            if ($body=$this->getPart($mid, 'text/html', $this->charset)) {
+                //Cleanup the html.
+                $body=Format::safe_html($body); //Balance html tags & neutralize unsafe tags.
+            }
+            elseif ($body=$this->getPart($mid, 'text/plain', $this->charset)) {
+                $body = Format::htmlchars($body);
+                $body = "<div style=\"white-space:pre-wrap\">$body</div>";
+            }
         }
-        elseif ($body = $this->getPart($mid,'TEXT/PLAIN', $this->charset)) {
-            // Escape anything that looks like HTML chars since what's in
-            // the database will be considered HTML
-            // TODO: Consider the reverse of the above edits (replace \n
-            //       <br/>
-            $body=Format::htmlchars($body);
-            if ($cfg->isHtmlThreadEnabled()) {
-                $body = wordwrap($body, 90);
-                $body = "<div style=\"white-space:pre\">$body</div>";
+        else {
+            if ($body=$this->getPart($mid, 'text/plain', $this->charset)) {
+                //Cleanup the html.
+                $body = Format::htmlchars($body);
+                $body = "<div style=\"white-space:pre-wrap\">$body</div>";
+            }
+            elseif ($body=$this->getPart($mid, 'text/html', $this->charset)) {
+                $body = convert_html_to_text($body, 100);
             }
         }
         return $body;
diff --git a/include/class.mailparse.php b/include/class.mailparse.php
index 145d10bf7a7d98f33373e9127cee02a5fe885dd3..4a3c5e6c5bb8c2e3c5c7f22f9c4a0165a8a6a7c5 100644
--- a/include/class.mailparse.php
+++ b/include/class.mailparse.php
@@ -158,17 +158,25 @@ class Mail_Parse {
 
     function getBody(){
 
-        if ($body=$this->getPart($this->struct,'text/html')) {
-            //Cleanup the html.
-            $body=Format::safe_html($body); //Balance html tags & neutralize unsafe tags.
-            if (!$cfg->isHtmlThreadEnabled()) {
-                $body = convert_html_to_text($body, 120);
+        if ($cfg->isHtmlThreadEnabled()) {
+            if ($body=$this->getPart($this->struct,'text/html')) {
+                //Cleanup the html.
+                $body=Format::safe_html($body); //Balance html tags & neutralize unsafe tags.
+            }
+            elseif ($body=$this->getPart($this->struct,'text/plain')) {
+                $body = Format::htmlchars($body);
                 $body = "<div style=\"white-space:pre-wrap\">$body</div>";
             }
         }
-        elseif ($body=$this->getPart($this->struct,'text/plain')) {
-            $body = Format::htmlchars($body);
-            $body = "<div style=\"white-space:pre-wrap\">$body</div>";
+        else {
+            if ($body=$this->getPart($this->struct,'text/plain')) {
+                //Cleanup the html.
+                $body = Format::htmlchars($body);
+                $body = "<div style=\"white-space:pre-wrap\">$body</div>";
+            }
+            elseif ($body=$this->getPart($this->struct,'text/html')) {
+                $body = convert_html_to_text($body, 100);
+            }
         }
         return $body;
     }