Not working for contact form and Symfony Mailer

Created on 8 February 2023, almost 2 years ago
Updated 28 November 2023, about 1 year ago

Problem/Motivation

When I submit a contact form that sends an email, the reroute mail doesn't work, and the email is sent it without reroute.

Steps to reproduce

I have Symfony Mailer 1.2.0-beta2 instal.led in Drupal 9.5.2 configured that all contat form mails sends to the site owner
<site>
I activate reroute mail and configurate that all mails go to a mail diferent than site owner mail
I test email with reroute test and email redirect correctly.
I create a contact form and test it.
No message of reroute apears, and the owner of de site get an email.

πŸ› Bug report
Status

Fixed

Version

2.3

Component

Code

Created by

πŸ‡ͺπŸ‡ΈSpain manuga

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

Comments & Activities

  • Issue created by @manuga
  • Can you try the last patch from https://www.drupal.org/project/reroute_email/issues/3261831 ✨ Support symfony_mailer, which doesn't use hook_mail_alter Fixed

  • πŸ‡ͺπŸ‡ΈSpain manuga

    Hello sboden,
    I tried this patch with composer and i couldn't install:
    Could not apply patch! Skipping. The error was: Cannot apply patch https://www.drupal.org/files/issues/2022-07-27/reroute-email-3261831-symfony_mailer-15.patch

    So I tried to install the patch directly in the module code and when i submit the contact form I got this error:
    TypeError: Argument 1 passed to reroute_email_mailer_build() must be an instance of EmailInterface, instance of Drupal\symfony_mailer\Email given in reroute_email_mailer_build() (line 375 of modules/contrib/reroute_email/reroute_email.module).

    So I changed this lines:

    use Drupal\symfony_mailer\EmailInterface;
    function reroute_email_mailer_build(EmailInterface $email) {

    To

    use Drupal\symfony_mailer\Email;
    function reroute_email_mailer_build(Email $email) {

    And i got the reroute email correctly
    There is something rong with the EmailInterface but i don't know what it is.

  • Status changed to Needs review about 1 year ago
  • πŸ‡ΊπŸ‡¦Ukraine abyss

    It seems that this has already been fixed in issue ✨ Support symfony_mailer, which doesn't use hook_mail_alter Fixed .
    @bohart, could you please confirm this?

  • Status changed to Fixed about 1 year ago
  • πŸ‡ΊπŸ‡¦Ukraine bohart Lutsk, Ukraine

    @Abyss, thanks for your time on testing!

    @manuga, please use the latest 2.3.x dev release of this module (it includes all needed fixes), or please wait a couple of weeks for the 2.3.1 release.
    NB: At least version 1.4.0 of Drupal Symfony Mailer should be installed to work both modules properly.

    Marking this issue as Fixed. Please re-open it or create a new one (if something is still not working).
    Thanks!

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

Production build 0.71.5 2024