Commit 7f1b28a0 authored by oadaeh's avatar oadaeh Committed by oadaeh

Issue #1408226 by oadaeh, Spleshka, Anybody, erbzh, sun, rudam, nitrocad:...

Issue #1408226 by oadaeh, Spleshka, Anybody, erbzh, sun, rudam, nitrocad: Subject not encoded for UTF-8 (garbled characters in Outlook)
parent 250647c4
......@@ -30,6 +30,9 @@ function mimemail_phpmailer_send($message) {
$mail->From = $from['mail'];
if ($from['name'] != '') {
$mail->FromName = $from['name'];
if (variable_get('smtp_encode_headers') && preg_match('/\=\?UTF-8\?B\?.*\?\=/', $from['name']) === 0) {
$mail->FromName = mime_header_encode($from['name']);
}
}
if (variable_get('phpmailer_debug_email', '') === '') {
......@@ -69,6 +72,9 @@ function mimemail_phpmailer_send($message) {
}
$message['headers']['Subject'] = $message['subject'];
if (variable_get('smtp_encode_headers') && preg_match('/\=\?UTF-8\?B\?.*\?\=/', $message['subject']) === 0) {
$message['headers']['Subject'] = mime_header_encode($message['subject']);
}
// FIXME SpamAssassin says INVALID_MSGID to PHPMailer's generated Message-ID. 06/04/2009 smk
// if (!isset($message['headers']['Message-ID'])) {
......@@ -85,4 +91,3 @@ function mimemail_phpmailer_send($message) {
return FALSE;
}
}
......@@ -136,6 +136,12 @@ function phpmailer_settings_form($form, $form_state) {
'#default_value' => variable_get('smtp_keepalive', 0),
'#description' => t('Whether to reuse an existing connection during a request. Improves performance when sending a lot of e-mails at once.'),
);
$form['advanced']['smtp_encode_headers'] = array(
'#type' => 'checkbox',
'#title' => t('Encode headers'),
'#default_value' => variable_get('smtp_encode_headers', 0),
'#description' => t('If you have subjects and names with accented, etc. characters, check this box to UTF-8 encode them before sending the message.'),
);
$form['advanced']['smtp_debug'] = array(
'#type' => 'select',
'#title' => t('Debug level'),
......@@ -344,4 +350,3 @@ function phpmailer_preview() {
print $body;
drupal_exit();
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment