Closed mstenta closed 1 month ago
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
@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
HI @mstenta,
I'm just going through all the various issues... and was wondering if there is any update on this?
Oh yes we can close this!
I am using the patch from the Drupal core issue linked above. It's working well!
I am in the process of moving over to
symfony/mailer
instead of the SMTP module. See https://github.com/farmOS/farmOS/pull/844After 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.