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;
  }
CommentFileSizeAuthor
#3 webform_trim_email-2211969.patch380 bytesquicksketch

Comments

quicksketch’s picture

Interesting, 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.

  • Commit 99d8648 on 7.x-4.x by quicksketch:
    Issue #2211969 by DanielaKirsch: Long format FROM address with newline...
quicksketch’s picture

Status: Active » Fixed
StatusFileSize
new380 bytes

I've committed this patch to all branches. Thanks!

  • Commit ee5af77 on 7.x-3.x by quicksketch:
    Issue #2211969 by DanielaKirsch: Long format FROM address with newline...

  • Commit 24389c4 on 6.x-3.x by quicksketch:
    Issue #2211969 by DanielaKirsch: Long format FROM address with newline...
fenstrat’s picture

Version: 7.x-3.20 » 8.x-4.x-dev
Assigned: DanielaKirsch » fenstrat
Status: Fixed » Patch (to be ported)

Needs porting to 8.x-4.x.

fenstrat’s picture

Version: 8.x-4.x-dev » 7.x-3.20
Assigned: fenstrat » Unassigned
Status: Patch (to be ported) » Fixed

Committed and pushed 99d8648 to 8.x-4.x. Thanks!

Status: Fixed » Closed (fixed)

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