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);
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | forward.module.patch | 785 bytes | rvolk |
Comments
Comment #1
rvolkExpected mail header:
Reply-to: =?UTF-8?B?U2hpTMO2bmc=?= <shilong@domain.tld>
Sorry < & > not converted... ;)
Comment #2
seanrFixed in HEAD, new release will be out soon.
Comment #3
rvolkHi 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
Comment #4
seanrCommitted. Thanks!