Skip to main content

Drupal Symfony Mailer - drupal update emails not received

Updated by Tim Rabbetts on
symfony mailer

In Drupal 9, swift mailer and other mailing solutions have been replaced with symfony mailer module.  I installed this module as a drop in replacement for Drupals core mail system.  However, the update module wasn't sending out emails.  I tracked the issue down to this code in the update module in core.

$message = \Drupal::service('plugin.manager.mail')->mail('update', 'status_notify', $target, $target_langcode, $params);

The module is hard wired to use the plugin.manager.mail service.  I replace this code with code that uses the symfony mailer module.

$emailFactory = \Drupal::service('email_factory');
$message = $emailFactory->newTypedEmail('update', 'status_notify', $params)
->setTo($target)
->send();

Here is the patch: 

Another issue I found was that the notification email for my site had the value 'dummy' in it, even though it was set correctly.  To solve this I added this entry to my settings.php.

$config['update.settings']['notification']['emails'][] = 'myemailaddress@example.com';

Now I have update notifications working.  

 

 

 

 

Add new comment