"Error sending email: An email must have a "To", "Cc", or "Bcc" header."

Created on 16 January 2025, 3 months ago

Problem/Motivation

Receiving the following message in DBlog
Error sending email: An email must have a "To", "Cc", or "Bcc" header.

This seems to be occuring when Cron is being executed.
The following message is being displayed on the front end.

Error message
Unable to send email. Contact the site administrator if the problem persists.

Steps to reproduce

Only able to produce when executing cron.
No stack trace are provided.
Can still send test mail from symfony without issues.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

1.5

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @99gs3
  • 🇬🇧United Kingdom adamps

    This module doesn't have a cron function, so I guess your email is likely being generated by another module, and that is where the bug is.

  • Thanks, is there any way to enabel stack trace?

    The error is generated by symfony but no stacktrace is being shown to allow tracking of error.

  • 🇦🇹Austria daniel.pernold

    We have the same issue. Normally there's no stacktrace provided, but when enabling Reroute Email the stack is printed (with the same problem).

    #0 /var/www/html/modules/contrib/reroute_email/src/RerouteEmailHandlerPluginBase.php(43): Drupal\reroute_email\Plugin\RerouteEmailHandler\HookMailAlter->setHeader('X-Rerouted-Orig...', NULL)
    #1 /var/www/html/modules/contrib/reroute_email/src/RerouteEmailHandlerPluginManager.php(77): Drupal\reroute_email\RerouteEmailHandlerPluginBase->process()
    #2 /var/www/html/modules/contrib/reroute_email/reroute_email.module(47): Drupal\reroute_email\RerouteEmailHandlerPluginManager->processAllByType('hook_mail_alter', Array)
    #3 /var/www/html/core/lib/Drupal/Core/Extension/ModuleHandler.php(552): reroute_email_mail_alter(Array, NULL, NULL)
    #4 /var/www/html/modules/contrib/symfony_mailer/src/Plugin/EmailBuilder/LegacyEmailBuilder.php(128): Drupal\Core\Extension\ModuleHandler->alter('mail', Array)
    #5 [internal function]: Drupal\symfony_mailer\Plugin\EmailBuilder\LegacyEmailBuilder->build(Object(Drupal\symfony_mailer\Email))
    #6 /var/www/html/modules/contrib/symfony_mailer/src/Email.php(490): call_user_func(Array, Object(Drupal\symfony_mailer\Email))
    #7 /var/www/html/modules/contrib/symfony_mailer/src/Mailer.php(179): Drupal\symfony_mailer\Email->process()
    #8 /var/www/html/modules/contrib/symfony_mailer/src/Mailer.php(149): Drupal\symfony_mailer\Mailer->doSend(Object(Drupal\symfony_mailer\Email))
    #9 /var/www/html/core/lib/Drupal/Core/Render/Renderer.php(638): Drupal\symfony_mailer\Mailer->Drupal\symfony_mailer\{closure}()
    #10 /var/www/html/modules/contrib/symfony_mailer/src/Mailer.php(147): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
    #11 /var/www/html/modules/contrib/symfony_mailer/src/Email.php(292): Drupal\symfony_mailer\Mailer->send(Object(Drupal\symfony_mailer\Email))
    #12 /var/www/html/modules/contrib/symfony_mailer/src/MailManagerReplacement.php(92): Drupal\symfony_mailer\Email->send()
    #13 /var/www/html/core/modules/update/update.fetch.inc(44): Drupal\symfony_mailer\MailManagerReplacement->mail('update', 'status_notify', '', 'de', Array)
    #14 /var/www/html/core/modules/update/update.module(188): _update_cron_notify()
    #15 /var/www/html/core/lib/Drupal/Core/Cron.php(337): update_cron()
    #16 /var/www/html/core/lib/Drupal/Core/Extension/ModuleHandler.php(395): Drupal\Core\Cron->Drupal\Core\{closure}(Object(Closure), 'update')
    #17 /var/www/html/core/lib/Drupal/Core/Cron.php(320): Drupal\Core\Extension\ModuleHandler->invokeAllWith('cron', Object(Closure))
    #18 /var/www/html/core/lib/Drupal/Core/Cron.php(159): Drupal\Core\Cron->invokeCronHandlers()
    #19 /var/www/html/core/lib/Drupal/Core/ProxyClass/Cron.php(75): Drupal\Core\Cron->run()
    #20 /var/www/html/core/modules/system/src/CronController.php(38): Drupal\Core\ProxyClass\Cron->run()
    #21 [internal function]: Drupal\system\CronController->run()
    #22 /var/www/html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
    #23 /var/www/html/core/lib/Drupal/Core/Render/Renderer.php(638): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
    #24 /var/www/html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(121): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
    #25 /var/www/html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
    #26 /var/www/vendor/symfony/http-kernel/HttpKernel.php(181): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
    #27 /var/www/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
    #28 /var/www/html/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #29 /var/www/html/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #30 /var/www/html/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #31 /var/www/html/core/modules/page_cache/src/StackMiddleware/PageCache.php(201): Drupal\Core\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #32 /var/www/html/core/modules/page_cache/src/StackMiddleware/PageCache.php(138): Drupal\page_cache\StackMiddleware\PageCache->fetch(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #33 /var/www/html/core/modules/page_cache/src/StackMiddleware/PageCache.php(87): Drupal\page_cache\StackMiddleware\PageCache->lookup(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #34 /var/www/html/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #35 /var/www/html/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #36 /var/www/html/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #37 /var/www/html/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #38 /var/www/html/core/lib/Drupal/Core/DrupalKernel.php(741): Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #39 /var/www/html/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
    #40 {main}
    
  • 🇦🇹Austria daniel.pernold

    It seems to be an issue with the update manager when no email addresses are set. Then the _update_cron_notify function in the module sends emails without a recipient.

  • Status changed to Postponed: needs info 19 days ago
  • @daniel.pernold

    Thanks, confirmed and resolved by adding email address.

Production build 0.71.5 2024