diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc index 84ec3c32a..505f5d644 100644 --- a/program/steps/mail/compose.inc +++ b/program/steps/mail/compose.inc @@ -1145,8 +1145,24 @@ function rcmail_create_draft_body($body, $bodyIsHtml) if ($bodyIsHtml) { $body = rcmail_wash_html($body, array('safe' => 1), $cid_map); - // remove comments (produced by washtml) - $body = preg_replace('//', '', $body); + // cleanup + $body = preg_replace(array( + // remove comments (produced by washtml) + '//', + // remove tags + '/]*)>/i', + '/<\/body>/i', + // convert TinyMCE's empty-line sequence (#1490463) + '/

\xC2\xA0<\/p>/', + ), + array( + '', + '', + '', + '


', + ), + $body + ); // replace cid with href in inline images links if (!empty($cid_map)) { diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc index d83f26e6a..c791c3d41 100644 --- a/program/steps/mail/sendmail.inc +++ b/program/steps/mail/sendmail.inc @@ -297,16 +297,22 @@ if (!$savedraft) { $message_body = preg_replace( array( + // remove empty signature div + '/
( )?<\/div>[\s\r\n]*$/', // remove signature's div ID '/\s*id="_rc_sig"/', // add inline css for blockquotes and container '/
/', - '/
/' + '/
/', + // convert TinyMCE's new-line sequences (#1490463) + '/

 <\/p>/', ), array( + '', '', '

', - '
' + '
', + '


', ), $message_body); }