Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RfcComplianceException: Email does not comply with addr-spec of RFC 2822 #657

Open
mstenta opened this issue May 9, 2024 · 2 comments
Open
Labels
bug Something isn't working

Comments

@mstenta
Copy link
Collaborator

mstenta commented May 9, 2024

I am in the process of moving over to symfony/mailer instead of the SMTP module. See farmOS/farmOS#844

After changing the Rothamsted instances I saw a few errors appear in logs related to the custom notifications code when a log edit form is submitted.

Symfony\\Component\\Mime\\Exception\\RfcComplianceException: Email [REDACTED] does not comply with addr-spec of RFC 2822. in Symfony\\Component\\Mime\\Address-\u003E__construct() (line 54 of \/opt\/drupal\/vendor\/symfony\/mime\/Address.php)

In all cases, it is attempting to send to multiple email addresses. I think this may just be due to the way we are using a string of comma-separated email addresses. So hopefully it's an easy fix. We just need to figure out what the proper format is.

I'd like to prioritize this so that I can remove the SMTP module with the next farmOS core update that I roll out.

@mstenta mstenta added the bug Something isn't working label May 9, 2024
@paul121
Copy link
Collaborator

paul121 commented May 9, 2024

There are a few functions involved in sending emails for Rothamsted... but ultimately we use MailManagerInterface::mail. It accepts a string $to parameter:

   * @param string $to
   *   The email address or addresses where the message will be sent to. The
   *   formatting of this string will be validated with the
   *   @link http://php.net/manual/filter.filters.validate.php PHP email validation filter. @endlink
   *   Some examples are:
   *   - user@example.com
   *   - user@example.com, anotheruser@example.com
   *   - User <user@example.com>
   *   - User <user@example.com>, Another User <anotheruser@example.com>

The farmOS core data stream email notification uses this same pattern

@mstenta
Copy link
Collaborator Author

mstenta commented May 9, 2024

@paul121 and I narrowed this down to a small bug in Drupal core's new SymfonyMailer class. It should be an easy fix. I opened an issue here and will explore creating a patch: https://www.drupal.org/project/drupal/issues/3446368

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants