Hi,
this issue destroy the header informations of from and reply-to values, when the senders name has special characters inside, which will be need to be encoded by the mime_header_encode() function.

Example:

Senders name: ShiLöng
Senders email: shilong@domain.tld

Combined to "ShiLöng " in "Reply-to" header.

Current mail header:
Reply-to: =?UTF-8?B?U2hpTMO2bmcgPHNoaWxvbmdAeGVsbC1uZXR3b3JrLmRlPg==?=

Expected mail header:
Reply-to: =?UTF-8?B?U2hpTMO2bmc=?=

The senders name must be encoded before sended to the drupal_mail() function. The drupal_mail() function will encode the hole header value if a special characted was found.

--PATCH suggestion--

+++ forward.module (working copy)
@@ -791,8 +791,8 @@
$from = variable_get('site_mail', '');
}

- $params['from'] = trim($form_state['values']['name'] .' <'. $from .'>');
- $params['headers']['Reply-To'] = trim($form_state['values']['name'] .' <'. $form_state['values']['email'] .'>');
+ $params['from'] = trim(mime_header_encode($form_state['values']['name']) .' <'. $from .'>');
+ $params['headers']['Reply-To'] = trim(mime_header_encode($form_state['values']['name']) .' <'. $form_state['values']['email'] .'>');

$recipients = trim($form_state['values']['recipients']);
$recipients = str_replace(array("\r\n", "\n", "\r"), ',', $recipients);

CommentFileSizeAuthor
#3 forward.module.patch785 bytesrvolk

Comments

rvolk’s picture

Expected mail header:
Reply-to: =?UTF-8?B?U2hpTMO2bmc=?= <shilong@domain.tld>

Sorry < & > not converted... ;)

seanr’s picture

Status: Active » Fixed

Fixed in HEAD, new release will be out soon.

rvolk’s picture

Version: 6.x-1.16 » 6.x-1.17
Status: Fixed » Patch (to be ported)
StatusFileSize
new785 bytes

Hi Seanr,
thanks for applying the patch, but it is still not fixed... the bracket of mime_header_encode() is placed wrong. The code should look like:

$params['from'] = trim(mime_header_encode($form_state['values']['name']) .' <'. $from .'>');
$params['headers']['Reply-To'] = trim(mime_header_encode($form_state['values']['name']) .' <'. $form_state['values']['email'] .'>');

Otherwise, the mime header will be corrupted. Patch attached.

Regards,
rvolk

seanr’s picture

Status: Patch (to be ported) » Fixed

Committed. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.