Use 7bit encoding for ISO-2022-* charsets in sent mail (#5640)

pull/5838/head
Aleksander Machniak 7 years ago
parent 6a83c3cc18
commit 6f87a32052

@ -13,6 +13,7 @@ CHANGELOG Roundcube Webmail
- Support LDAP GSSAPI authentication (#5703)
- Allow contacts without an email address (#5079)
- Localized timezone selector (#4983)
- Use 7bit encoding for ISO-2022-* charsets in sent mail (#5640)
- Fix various issues when downloading files with names containing non-ascii chars, use RFC 2231 (#5772)
- Password: Fix compatibility with PHP 7+ in cpanel_webmail driver (#5820)
- Fix decoding non-ascii attachment names from TNEF attachments (#5646, #5799)

@ -60,7 +60,7 @@ if (!$savedraft) {
/****** compose message ********/
// set default charset
$message_charset = isset($_POST['_charset']) ? $_POST['_charset'] : $OUTPUT->get_charset();
$message_charset = rcube_utils::get_input_value('_charset', rcube_utils::INPUT_POST) ?: $OUTPUT->get_charset();
$EMAIL_FORMAT_ERROR = NULL;
$RECIPIENT_COUNT = 0;
@ -483,14 +483,19 @@ if (is_array($COMPOSE['attachments'])) {
}
}
// choose transfer encoding for plain/text body
if (preg_match('/[^\x00-\x7F]/', $MAIL_MIME->getTXTBody())) {
$text_charset = $message_charset;
$text_charset = $message_charset;
$transfer_encoding = '7bit';
$head_encoding = 'quoted-printable';
// choose encodings for plain/text body and message headers
if (preg_match('/ISO-2022/i', $message_charset)) {
$head_encoding = '7bit';
}
else if (preg_match('/[^\x00-\x7F]/', $MAIL_MIME->getTXTBody())) {
$transfer_encoding = $RCMAIL->config->get('force_7bit') ? 'quoted-printable' : '8bit';
}
else {
$text_charset = 'US-ASCII';
$transfer_encoding = '7bit';
else if ($message_charset == 'UTF-8') {
$text_charset = 'US-ASCII';
}
if ($flowed) {
@ -517,7 +522,7 @@ if ($pgp_mime) {
// encoding settings for mail composing
$MAIL_MIME->setParam('text_encoding', $transfer_encoding);
$MAIL_MIME->setParam('html_encoding', 'quoted-printable');
$MAIL_MIME->setParam('head_encoding', 'quoted-printable');
$MAIL_MIME->setParam('head_encoding', $head_encoding);
$MAIL_MIME->setParam('head_charset', $message_charset);
$MAIL_MIME->setParam('html_charset', $message_charset);
$MAIL_MIME->setParam('text_charset', $text_charset);

Loading…
Cancel
Save