- Issue created by @huzooka
- π¬π§United Kingdom adamps
I don't yet see any bug.
DefaultsEmailAdjuster
sets the sender address. If nothing sets a from, Symfony will set it to match the sender.LegacyEmailBuilder::build()
callshook_mail()
thenhook_mail_alter()
. This is by design only forLegacyEmailBuilder
- in other cases we don't want to callhook_mail()
and we therefore can't callhook_mail_alter()
because the expected values to alter won't be present.- Email adjuster plug-ins can set a weight. If they set a weight greater than
LegacyEmailBuilder
then they will see the results of the above two hooks.
- π³π±Netherlands wilfred waltman
I kind of experience the same problem, or at least I think. It occurred during the migration to Drupal 10 while using version 1.4.0 of Drupal Symfony Mailer.
When I do not alter the From-header in the hook_mail of my custom module, the site name and mail are implemented in the From header.
As soon as I try to alter the From header in the hook_mail, it results in me getting {{ getSender(message) }} as the From name.I added a screenshot for clarification.
- Status changed to Fixed
about 1 year ago 12:03pm 21 November 2023 - Status changed to Active
about 1 year ago 11:31am 23 November 2023 - π³π±Netherlands wilfred waltman
@adamps, can you tell me what is fixed? Or how I can fix it myself?
Because I still experience the issue.
- πͺπΈSpain rcodina Barcelona
@AdamPS I migrated to Symfony mailer module from Swiftmailer while upgrading Drupal to 10.1 from 9 version. In my site I had a
hook_mail_alter
to style the register email to be an HTML mail using a Twig template. Now, thehook_mail_alter
isn't called. What should I do to recover this feature? It's an strict requirement from my customer. - πͺπΈSpain rcodina Barcelona
I finally migrated to SMTP + Mime mail and I removed Symfony mailer to preserve
hook_mail_alter
features. - Status changed to Closed: works as designed
about 1 year ago 12:18pm 28 November 2023 - π¬π§United Kingdom adamps
If fixed is confusing, then let's call it "works as designed". @Wilfred Waltman and @rcodina please see #2 where I explained that everything seems to be working exactly as I would expect.
Or how I can fix it myself?
See bullet 3 in #2. You can set the weight for your EmailAdjuster to control whether you run before or after LegacyEmailBuilder.