]> git.donarmstrong.com Git - roundcube.git/blobdiff - program/steps/mail/sendmail.inc
Imported Upstream version 0.2.2
[roundcube.git] / program / steps / mail / sendmail.inc
index 445ba206bf95705e811c87e1dbc9fce184911fd4..418e1728327213e2bc08180479a43b419a78147d 100644 (file)
@@ -16,7 +16,7 @@
  | Author: Thomas Bruederli <roundcube@gmail.com>                        |
  +-----------------------------------------------------------------------+
 
- $Id: sendmail.inc 2320 2009-03-01 07:55:39Z alec $
+ $Id: sendmail.inc 2483 2009-05-15 10:22:29Z thomasb $
 
 */
 
@@ -302,10 +302,10 @@ if ($isHtml)
   $MAIL_MIME->setHTMLBody($message_body . ($footer ? "\r\n<pre>".$footer.'</pre>' : ''));
 
   // add a plain text version of the e-mail as an alternative part.
-  $h2t = new html2text($message_body);
-  $plainTextPart = $h2t->get_text() . ($footer ? "\r\n".$footer : '');
+  $h2t = new html2text($message_body, false, true, 0);
+  $plainTextPart = rc_wordwrap($h2t->get_text(), 75, "\r\n"). ($footer ? "\r\n".$footer : '');
   $plainTextPart = wordwrap($plainTextPart, 998, "\r\n", true);
-  if (!strlen($plainTextPart)) 
+  if (!strlen($plainTextPart))
     { 
     // empty message body breaks attachment handling in drafts 
     $plainTextPart = "\r\n"; 
@@ -317,7 +317,7 @@ if ($isHtml)
   }
 else
   {
-  $message_body = wordwrap($message_body, 75, "\r\n");
+  $message_body = rc_wordwrap($message_body, 75, "\r\n");
   if ($footer)
     $message_body .= "\r\n" . $footer;
   $message_body = wordwrap($message_body, 998, "\r\n", true);
@@ -342,7 +342,7 @@ if (is_array($_SESSION['compose']['attachments']))
     if ($isHtml && ($match > 0))
     {
       $message_body = preg_replace($dispurl, ' src="'.$attachment['name'].'" ', $message_body);
-      $MAIL_MIME->setHTMLBody($message_body. ($footer ? "\r\n<pre>".$footer.'</pre>' : ''));
+      $MAIL_MIME->setHTMLBody($message_body);
       $MAIL_MIME->addHTMLImage($attachment['path'], $attachment['mimetype'], $attachment['name']);
     }
     else