1

I have configuration Mailsystem to send all webform emails as HTML, I thought I could use the "key" in mailsystem's configuration to specify which webforms' submissions get sent as HTML or plain text. Unchecking the checkbox on the webform's email handler to say "Send email as HTML" only strips HTML from mail, but the wrapper is still HTML.

While keeping HTML emails for most webform generated emails, how do I configure one to be sent as plain text?

1 Answer 1

2

There are two parts to this answer 1) Mailsystem configuration and 2) Mailsystem template suggestions.

1) Mailsystem configuration

This solved the issue for me and I was perhaps being silly: Go to /admin/config/system/mailsystem and set Mime Mailer as your default config, well I want that as default. default Mailsystem config

Then below I had webform config for all webforms, but this was overkill as the settings above already made webforms use Mime Mailer, what I needed to do was add an override for this one email handler: Module Mailsystem overrides

The specific email handler machine name was email so you can see its key is "email_email".

2) Mailsystem template suggestions

Something I learnt while investigating this is that there are template suggestions added by mimemail.module of the following pattern:

$suggestions[] = "mimemail_messages__" . $variables['key'];

So the above webform email, if using mimemail would use a template named mimemail-messages--email-email.html.twig

1
  • This answer worked for me. Thanks for posting such an informative stuff.
    – Pupil
    Mar 11, 2020 at 11:19

Your Answer

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

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