From 7145e009e440ef4d6dcba2b4845656376c9d8ccd Mon Sep 17 00:00:00 2001 From: alecpl Date: Mon, 30 Mar 2009 18:04:18 +0000 Subject: - Fix incorrect word wrapping in outgoing plaintext multibyte messages (#1485714) - Fix double footer in HTML message with embedded images --- program/steps/mail/compose.inc | 2 +- program/steps/mail/func.inc | 6 +++--- program/steps/mail/sendmail.inc | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'program/steps/mail') diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc index ab25b1b8d..49c4c3011 100644 --- a/program/steps/mail/compose.inc +++ b/program/steps/mail/compose.inc @@ -490,7 +490,7 @@ function rcmail_create_reply_body($body, $bodyIsHtml) } // add title line(s) - $prefix = wordwrap(sprintf("On %s, %s wrote:\n", + $prefix = rc_wordwrap(sprintf("On %s, %s wrote:\n", $MESSAGE->headers->date, $MESSAGE->get_header('from')), 76); diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc index 79e148d8a..a76532cb9 100644 --- a/program/steps/mail/func.inc +++ b/program/steps/mail/func.inc @@ -1179,7 +1179,7 @@ function rcmail_wrap_quoted($text, $max = 76) $prefix = substr($line, 0, $length); // Remove '> ' from the line, then wordwrap() the line - $line = wordwrap(substr($line, $length), $max - $length); + $line = rc_wordwrap(substr($line, $length), $max - $length); // Rebuild the line with '> ' at the beginning of each 'subline' $newline = ''; @@ -1191,7 +1191,7 @@ function rcmail_wrap_quoted($text, $max = 76) $line = rtrim($newline); } else { - $line = wordwrap($line, $max); + $line = rc_wordwrap($line, $max); } } @@ -1390,7 +1390,7 @@ function rcmail_send_mdn($uid) "Disposition: manual-action/MDN-sent-manually; displayed\r\n"; $compose->headers($headers); - $compose->setTXTBody(wordwrap($body, 75, "\r\n")); + $compose->setTXTBody(rc_wordwrap($body, 75, "\r\n")); $compose->addAttachment($report, 'message/disposition-notification', 'MDNPart2.txt', false, '7bit', 'inline'); $sent = rcmail_deliver_message($compose, $identity['email'], $mailto); diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc index eb81fc9ad..9607619e9 100644 --- a/program/steps/mail/sendmail.inc +++ b/program/steps/mail/sendmail.inc @@ -302,10 +302,10 @@ if ($isHtml) $MAIL_MIME->setHTMLBody($message_body . ($footer ? "\r\n
".$footer.'
' : '')); // 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
".$footer.'
' : '')); + $MAIL_MIME->setHTMLBody($message_body); $MAIL_MIME->addHTMLImage($attachment['path'], $attachment['mimetype'], $attachment['name']); } else -- cgit v1.2.3