Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: Views Bootstrap 5.5.4 — Minor update available for module views_bootstrap (5.5.4). Release: Rightup theme 1.0.3 — Minor update available for theme vartheme_bs5_rightup (1.0.3). Release: CommentOn 1.0.6 — Minor update available for module commenton (1.0.6). Release: ChatGPT Ads 1.0.3 — Minor update available for module chatgpt_ads (1.0.3). Release: Opensolr Search 5.1.3 — Minor update available for module opensolr_search (5.1.3). Release: ServiceM8 Webform Integration 1.2.1 — Minor update available for module servicem8_webform (1.2.1). Release: PostfixAdmin 1.0.0 — Initial release available for module postfix_admin (1.0.0)! Release: ip_analyser 1.0.3 — Minor update available for module ip_analyser (1.0.3). Module Revived: Swagger-PHP OpenAPI 3 documentation generator 1.0.0 — Module swagger_php updated after 10 months of inactivity (1.0.0). Security Coverage: Microsoft Azure AI — Module ai_provider_azure now has official Drupal security advisory coverage.

Overview

This module provides an integration of pelago/emogrifier. It inserts inline styles into HTML from CSS for better sending emails. Because CSS files and classes are often removed by various email provider, this will ensure that your styles will stay in your emails, so they will more likely be perceived by the recipient as intended. The module comes with a mail formatter plugin using the swiftmailer, to replace the mail body before the sending.

Features

  • Send HTML emails with inline css styles to drastically increase the chance that your emails will be perceived as intended
  • Low effort configuration: Set the formatter, add your css via library, done
  • Can add extra css, based on the specific email being sent

Usage

  • Install this module as usual
  • Go to /admin/config/system/mailsystem
  • Select the "Swift Mailer Emogrify" plugin as the formatter.¹
  • Add a new library to your THEME.libraries.yml using the 'mail' key and add your css file(s):

    mail:
      css:
        component:
          css/mail.css: {}
    



    CSS in emails is pretty restricted. There are many things that do not work as you expect on a website like media queries,
    so it is recommended to prepare a CSS file for explicit email use only.

  • If needed, you can provide extra CSS for specific emails which need special styling because of their special templates:

    mail_MAIL_KEY:
      css:
        component:
          css/additional_mail.css: {}
    



    Example: You're using Drupal's commerce module and want to style the order receipt mail, you would add a library "mail_order_receipt".

¹ Note: the "Swift Mailer Emogrify" plugin can also be selected as a "sender" because a mail plugin provides both
a formatter and sender, but it does exactly the same as the default "Swift Mailer".

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
1
Tracked since
Jun 2024
Latest release
2 years ago
Releases (12 mo)
0
Maintenance
Dormant

Releases

Version Type Core Release date
1.0.x-dev Dev Jun 28, 2024