Problem

In EmailWebformHandler::sendMessage() there is a 'from' address which is being constructed from the name and the mail. Currently it has the the "mail_address " format, but is this format valid? Shouldn't it be "Mail Name "? When using the current format I had quite some issues with the 'From' header containing some other things (in this case was the domain name of the testing server). By changing to "Mail Name " the issues were solved.

Proposed solution

This should be pretty straight forward, something like:

$from = $message['from_mail'];
if (!empty($message['from_name'])) {
  $from = $message['from_name'] . ' <'  . $from . '>';
}

But again, not sure if the current format is really not valid.

CommentFileSizeAuthor
#3 from_address_format_2864355_3.patch846 bytesvasi1186

Comments

vasi1186 created an issue. See original summary.

jrockowitz’s picture

I think you are right and core is using User <user@example.com>.

@see \Drupal\Core\Mail\MailManager::doMail

Would be able to upload a patch and change this ticket's status to 'Needs review', which will trigger the automated tests.

vasi1186’s picture

Status: Active » Needs review
StatusFileSize
new846 bytes

Attached a patch that should fix the issue.

  • jrockowitz committed a73d345 on 8.x-5.x authored by vasi1186
    Issue #2864355 by vasi1186: 'From' address possibly not having the right...
jrockowitz’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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