After updating symfony_mailer from 1.5 to 1.6 we noticed that all mails send through webform are no longer rerouted.
We are using reroute_email module for that.
Not sure if this is an issue with symfony_mailer, reroute_email or webform...
I'm posting it here because we have only updated symfony_mailer when we noticed this issue. The other modules have not been updated.

I will try and do some further digging en debugging to figure out what is going wrong and report back if/when I find something.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

weseze created an issue. See original summary.

adamps’s picture

Title: Updating from 1.5 to 1.6 broke rerouting for webforms » [Regression in 1.6] hook_mail() cannot alter email "to" header

Thanks for the report. Sorry I believe it was caused by #3421400: Change to the phases.

I took the code that alters "to" out of LegacyMailerHelper::emailFromArray() because this was too late and was causing wrong languages. It's tricky because whatever order I do things in seems to break some specific case😃.

adamps’s picture

Title: [Regression in 1.6] hook_mail() cannot alter email "to" header » [Regression in 1.6] hook_mail_alter() cannot alter email "to" header

Potentially we can fix something like this:

  • Remove the new @trigger_error in BaseEmailTrait::setAddress.
  • Put back the code removed from LegacyMailerHelper. NB if code alters the to address in hook_mail_alter (during the build phase) they should note that it won't affect the language (which is based on checking if the "to" address belongs to a user, and using that user's language) as it's too late.
  • Keep the new code in LegacyEmailBuilder to set "to" during the init phase - this is a better time to set "to" in general because it can affect language.
adamps’s picture

Title: [Regression in 1.6] hook_mail_alter() cannot alter email "to" header » [Regression in 1.6] hook_mail_alter() cannot alter email "to" header - breaks "Reroute Email" module
adamps’s picture

I added a warning to the release note.

adamps’s picture

Version: 1.6.0 » 2.x-dev

  • adamps committed 735f73c9 on 2.x
    Issue #3527050 by adamps: [Regression in 1.6] hook_mail_alter() cannot...

adamps’s picture

Fixed in v2 next backport to v1

adamps’s picture

Status: Needs work » Needs review

v1 MR is ready for review and test please

adamps’s picture

Version: 2.x-dev » 1.x-dev
Issue tags: +needs backport to 1.x
weseze’s picture

I tested the 1.6 + patch file based on "24ec304e - V1 backport".
This work as expected for us. Both in webform mails, and other mails.

adamps’s picture

Issue tags: -needs backport to 1.x

Great thanks

  • adamps committed d2f76052 on 1.x
    Issue #3527050 by adamps, weseze: hook_mail_alter() cannot alter email "...
adamps’s picture

Version: 1.x-dev » 1.6.0
Status: Needs review » Fixed
adamps’s picture

I created a 1.6.1 release containing this fix.

weseze’s picture

Thanks for the quick response and the new release!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.