Allow setParams in all phases

Created on 6 November 2023, 8 months ago
Updated 9 November 2023, 8 months ago

Problem/Motivation

LogicException: setParams function is only valid in phases 0-0, called in 3. in Drupal\symfony_mailer\Email->valid() (line 594 of modules/contrib/symfony_mailer/src/Email.php).

Steps to reproduce

In hook_mailer_post_render(EmailInterface $email) I tried to add new params it throws an error. (setParams function is only valid in phases 0-0, called in 3)

$email->setSubject(), $email->setTextBody(''); $email->addTextHeader() are running successfully but while set the params it throws an error.

✨ Feature request
Status

Active

Version

1.4

Component

Code

Created by

🇮🇳India hesnvabr

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

Comments & Activities

  • Issue created by @hesnvabr
  • 🇬🇧United Kingdom AdamPS

    I agree this would be useful and I'm willing to change it. It's not a bug because the interface comment is clear: "Valid: initialisation".

  • Status changed to Fixed 8 months ago
  • 🇮🇳India hesnvabr

    This one is solved by using another phase hook_mailer_init().

    Thankyou

  • Status changed to Active 8 months ago
  • 🇬🇧United Kingdom AdamPS

    Great news. I still think it's worth fixing so we can keep open.

Production build 0.69.0 2024