I am using HTML Mail module. I have created an html email template specific to my form(webform) in the template folder of my theme directory. My form name is newsletter and the template name is htmlmail--webform--newsletter_email.html.twig

I want to override the email body based on a particular language. But my problem is that hook_mail_alter doesn't work in my case.

Drupal API documentation for hook_mail_alter says that hook_mail_alter() allows modification of email messages created and sent with MailManagerInterface->mail().

Any help?

1 Answer 1


The hook hook_mail_alter() should work in this case.

Have you double checked if your module is activated and you have cleared your cache after adding the hook?

Also i am not sure if your template will work, because normally all templates are working with dashes instead of underscores.

  • Yes did everything. But it didn't work. Also template is working. I already checked that. Aug 2, 2019 at 9:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.