diff options
author | alecpl <alec@alec.pl> | 2010-12-06 11:13:55 +0000 |
---|---|---|
committer | alecpl <alec@alec.pl> | 2010-12-06 11:13:55 +0000 |
commit | 74728935122fe35ed97c40092080cc7dfd4b7052 (patch) | |
tree | 8a523405d4411c74a583be07555c8d49cbf380ef /program/steps | |
parent | 9e81b55616ea64e1a754174a7008efac26a2f285 (diff) |
- Fix plaintext versions of HTML messages don't contain placeholders for emotions (#1485206)
Diffstat (limited to 'program/steps')
-rw-r--r-- | program/steps/mail/sendmail.inc | 12 | ||||
-rw-r--r-- | program/steps/utils/html2text.inc | 7 |
2 files changed, 14 insertions, 5 deletions
diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc index 95b490969..a796c7ba7 100644 --- a/program/steps/mail/sendmail.inc +++ b/program/steps/mail/sendmail.inc @@ -70,7 +70,7 @@ function rcmail_encrypt_header($what) function rcmail_get_identity($id) { global $USER, $OUTPUT; - + if ($sql_arr = $USER->get_identity($id)) { $out = $sql_arr; $out['mailto'] = $sql_arr['email']; @@ -100,7 +100,7 @@ function rcmail_fix_emoticon_paths(&$mime_message) // remove any null-byte characters before parsing $body = preg_replace('/\x00/', '', $body); - + $searchstr = 'program/js/tiny_mce/plugins/emotions/img/'; $offset = 0; @@ -193,6 +193,7 @@ function rcmail_email_input_format($mailto, $count=false, $check=true) return implode(', ', $result); } + /****** compose message ********/ if (strlen($_POST['_draft_saveid']) > 3) @@ -441,13 +442,16 @@ if ($isHtml) { $MAIL_MIME->setHTMLBody($plugin['body']); + // replace emoticons + $plugin['body'] = rcmail_replace_emoticons($plugin['body']); + // add a plain text version of the e-mail as an alternative part. $h2t = new html2text($plugin['body'], false, true, 0); $plainTextPart = rc_wordwrap($h2t->get_text(), $LINE_LENGTH, "\r\n"); $plainTextPart = wordwrap($plainTextPart, 998, "\r\n", true); if (!$plainTextPart) { - // empty message body breaks attachment handling in drafts - $plainTextPart = "\r\n"; + // empty message body breaks attachment handling in drafts + $plainTextPart = "\r\n"; } else { // make sure all line endings are CRLF (#1486712) diff --git a/program/steps/utils/html2text.inc b/program/steps/utils/html2text.inc index ef74ec49e..15c6a52a4 100644 --- a/program/steps/utils/html2text.inc +++ b/program/steps/utils/html2text.inc @@ -19,7 +19,12 @@ */ -$converter = new html2text($HTTP_RAW_POST_DATA); +$html = $HTTP_RAW_POST_DATA; + +// Replace emoticon images with its text representation +$html = rcmail_replace_emoticons($html); + +$converter = new html2text($html); header('Content-Type: text/plain; charset=UTF-8'); print rtrim($converter->get_text()); |