Magic HTML Mail
HTML Mail enables Drupal to send clean, fully formatted HTML emails with twig-based template customization, inline CSS styling, and reliable plain-text fallbacks.
By default, Drupal core sends plain-text emails for user registrations, password resets, and module notifications. HTML Mail replaces plain text with structured, beautifully styled HTML emails. It allows site builders and developers to apply custom Twig templates, wrap outbound system emails in site branding, and ensure consistent rendering across all major email clients.
Features
- HTML Formatting for Outbound Mail: Automatically converts core and module system emails into clean HTML messages.
- Twig Template Integration: Override email layouts and components using standard Drupal theme Twig templates.
- Automatic CSS Inlining: Integrates CSS styling directly into email HTML tags to prevent broken layouts in strict mail clients (like Gmail or Outlook).
- Multipart Plain-Text Fallback: Automatically generates plain-text alternative versions for mail clients that do not support HTML rendering.
- Module & Mailer Compatibility: Seamlessly hooks into Drupal’s core Mail API and works alongside modern mail transport modules like Symfony Mailer or Mailsystem.
Post-Installation
- Install and enable the module via Composer or Drush.
- Navigate to Administration → Configuration → System → HTML Mail (
/admin/config/system/html_mail). - Configure your default mail formatting settings, CSS stylesheet attachments, and fallback plain-text rules.
- (Optional) Copy the provided
html-mail.html.twigtemplate file into your custom theme directory to customize headers, footers, or wrapper branding.
Additional Requirements
- Drupal Core:
^10.3 || ^11 - System Requirements: A configured mail subsystem or transport module (e.g. Symfony Mailer, SMTP, or core PHP Mail) to deliver outbound messages.
Recommended modules/libraries
- Symfony Mailer: Provides modern SMTP and API transport layer integrations for seamless email delivery.
- Magic Login: Pairs well to send beautifully branded, passwordless sign-in links and 6-digit codes to users.
Similar projects
While modules like swiftmailer or legacy mailsystem setups offer complex mail handling, HTML Mail focuses on lightweight, direct HTML formatting and template override capabilities native to modern Drupal 10.3+ and 11 environments without unneeded overhead.
Supporting this Module
If you find this module useful in styling your site's transactional emails, consider starring the repository on GitHub or reporting feedback in the issue queue to assist ongoing maintenance.
Community Documentation
For complete template customization guidelines, hook definitions, and configuration examples, refer to the project README in
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
Releases
| Version | Type | Core | Release date | |
|---|---|---|---|---|
| 1.0.0 | Stable | 10–11 | Oct 8, 2026 |