You are here

mimemail-message.html.twig in Mime Mail 8

Default template to format a HTML email using the Mime Mail module.

Copy this file in your default theme folder to create a custom themed email. If you modify this template you MUST be sure to keep the html, body, and header tags. This template should produce a fully-formed HTML document. Failure to include these will result in a malformed email and possibly errors shown to the user when sending email.

To override this template for all emails sent by a given module, rename this template to mimemail-messages--[module].html.twig.

To override this template for a specific email sent by a given module, rename this template to mimemail-messages--[module]--[key].html.twig.

Available variables:

  • attributes: HTML attributes for the body element of the message.
  • key: The message identifier.
  • module: The machine name of the sending module.
  • css: Internal style sheets.
  • recipient: The recipient of the message.
  • subject: The message subject.
  • body: The message body.

File

templates/mimemail-message.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Default template to format a HTML email using the Mime Mail module.
  5. *
  6. * Copy this file in your default theme folder to create a custom themed email.
  7. * If you modify this template you MUST be sure to keep the html, body, and
  8. * header tags. This template should produce a fully-formed HTML document.
  9. * Failure to include these will result in a malformed email and possibly
  10. * errors shown to the user when sending email.
  11. *
  12. * To override this template for all emails sent by a given module,
  13. * rename this template to mimemail-messages--[module].html.twig.
  14. *
  15. * To override this template for a specific email sent by a given module,
  16. * rename this template to mimemail-messages--[module]--[key].html.twig.
  17. *
  18. * Available variables:
  19. * - attributes: HTML attributes for the body element of the message.
  20. * - key: The message identifier.
  21. * - module: The machine name of the sending module.
  22. * - css: Internal style sheets.
  23. * - recipient: The recipient of the message.
  24. * - subject: The message subject.
  25. * - body: The message body.
  26. *
  27. * @see template_preprocess_mimemail_message()
  28. *
  29. * @ingroup themeable
  30. */
  31. #}
  32. {% set classes = module ? (key ? module ~ '-' ~ key) %}
  33. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  34. <html>
  35. <head>
  36. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  37. <title>Mime Mail message template</title>
  38. {% if css %}
  39. <style type="text/css">
  40. <!-- {{ css }} -->
  41. </style>
  42. {% endif %}
  43. </head>
  44. <body id="mimemail-body"{{ attributes.addClass(classes) }}>
  45. <div id="center">
  46. <div id="main">
  47. {{ body|raw }}
  48. </div>
  49. </div>
  50. </body>
  51. </html>