Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Go to the admin backend admin/config/content/webform and set "Long format: "Example Name" " in advanced options. In Default E-Mail values add a string with foreign characters like german umlauts "ä" in from name.
Submit a webform.
In your email client the from address will be broken.
This is because the from address is encoded in webform module line 3360 but mime_header_encode returns a string with a newline at the end. Therefore you will have something like this:
" =?UTF-8?B?Superm%C3%A4rkte?=\n "
webform_module line 3360:
if ($format == 'long' && !empty($name)) {
$name = _webform_filter_values($name, $node, $submission, NULL, FALSE, TRUE);
if ($encode) {
$name = mime_header_encode($name);
}
return '"' . $name . '" <' . $address . '>';
}
else {
return $address;
}
The newline should be removed before returned:
if ($format == 'long' && !empty($name)) {
$name = _webform_filter_values($name, $node, $submission, NULL, FALSE, TRUE);
if ($encode) {
$name = mime_header_encode($name);
}
$name = preg_replace("/[\n\r]/","",$name);
return '"' . $name . '" <' . $address . '>';
}
else {
return $address;
}
Comment | File | Size | Author |
---|---|---|---|
#3 | webform_trim_email-2211969.patch | 380 bytes | quicksketch |
Comments
Comment #1
quicksketchInteresting, great sleuthing on this one. For simplicity, we could also probably just use trim() instead of a preg_replace(). This issue needs to be fixed in all 3 branches.
Comment #3
quicksketchI've committed this patch to all branches. Thanks!
Comment #6
fenstratNeeds porting to 8.x-4.x.
Comment #7
fenstratCommitted and pushed 99d8648 to 8.x-4.x. Thanks!