19967: Read Mail shows empty content with option 'Always plain text' issue_19967
authorTJ <virtualmin@iam.tj>
Wed, 26 Oct 2011 00:50:23 +0000 (01:50 +0100)
committerTJ <virtualmin@iam.tj>
Wed, 26 Oct 2011 00:50:23 +0000 (01:50 +0100)
mailboxes/folders-lib.pl

index 231b3ea..78d7587 100755 (executable)
@@ -2169,7 +2169,19 @@ foreach $a (@{$_[0]->{'attach'}}) {
                }
        }
 if ($_[1] == 0) {
-       $body = $textbody;
+       if ($textbody) {
+               $body = $textbody;
+               }
+       elsif ($htmlbody) {
+               local $text = &html_to_text($htmlbody->{'data'});
+               $body = $textbody =
+                       { 'data' => $text };
+               }
+       else {
+               local $text = "<strong>This email has no content.</strong>";
+               $body = $textbody =
+                       { 'data' => $text };
+               }
        }
 elsif ($_[1] == 1) {
        $body = $textbody || $htmlbody;