Drupal hook_mail_alter modifications not present in final email when using Mailjet

Created on 27 March 2025, 10 days ago

Problem/Motivation

I'm facing an issue where my custom modifications in hook_mail_alter() are not being applied to the final email that is sent, even though my dump shows the modifications exist.

Drupal Version: 10.2.7

Mailjet Module: 4.0.2

Webform Module: 6.2.6

Email Use Case: The email in question is a confirmation email generated by the Webform module.

Steps to reproduce

Implement hook_mail_alter() in a custom module to modify the email body.

Append an extra link to the email content.

Log the $message array to confirm that the modifications are applied.

Submit a Webform that triggers an email.

Check the received email and notice that the modifications are missing.

  • Has anyone experienced a similar issue where modifications in hook_mail_alter() are overwritten, particularly when using the Mailjet module with Webform?
  • Could the Mailjet module be processing the email content after hook_mail_alter() has executed, and if so, is there an alternative hook or workaround?
  • Are there known issues or configuration settings in Mailjet 4.0.2 that might cause this behavior?

Thank you

🐛 Bug report
Status

Active

Version

4.0

Component

Code

Created by

🇫🇷France tchida Paris

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

Comments & Activities

Production build 0.71.5 2024