Problem/Motivation

First of all, this is not a dupe of #3299164: Token error - does not comply with addr-spec of RFC 2822 ;) A random test of the contact webform on our new website failed due to "Email does not comply with addr-spec of RFC 2822" error.

On investigating the problem, I've seen that this "From" header was set on the message:

"DDr. Mag. Maximilian Gustavo Mustermann-Garcia, PhD, LMAA"

which should be fine - however the error log showed only the name part in its message:

Email ""DDr. Mag. Maximilian Gustavo Mustermann-Garcia" does not comply with addr-spec of RFC 2822

So obviously, the e-mail part gets cut off here.

On further investigation, I've seen that core already has fixed the same problem here: #3226117: Uncaught RfcComplianceException when email From name contains a comma

Steps to reproduce

Configure a webform with a "name" field and configure an e-mail handler, using this token as "From" address: [name] <[site:mail]>

I've also disabled symfony_mailer and let core send the same e-mail - and it worked (the mentioned core issue is already fixed, as oyu can see)

Proposed resolution

The problem should lie inside MailerHelper::parseAddress() imho. However, replacing explode(',', $encoded) with str_getcsv() like core did, seems not do solve the problem. I guess, this change would be necessary as well, but also there might be a problem with the self::FROM_STRING_PATTERN too.. However I couldn't figure it out, was already happy to find this place, when I was already a bit lost inside the symfony_mailer codebase :D But this should be a good starting point for the maintainer, hopefully :)

Remaining tasks

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

agoradesign created an issue. See original summary.

agoradesign’s picture

PS: I'm using 1.2.2

adamps’s picture

Status: Active » Closed (duplicate)
agoradesign’s picture

agree ;)

mamoruua made their first commit to this issue’s fork.