Drupal is a registered trademark of Dries Buytaert
Protected Pages 3.0.0 Major update available for module protected_pages (3.0.0). Commerce Core 3.3.8 Minor update available for module commerce (3.3.8). Search API HTML Element Filter 1.0.7 Minor update available for module search_api_html_element_filter (1.0.7). Layout Builder Reorder 2.0.1 Minor update available for module layout_builder_reorder (2.0.1). Ban 1.1.0 Minor update available for module ban (1.1.0). Field Formatter Range 2.0.0 Major update available for module field_formatter_range (2.0.0). Field Formatter Range 8.x-1.8 Minor update available for module field_formatter_range (8.x-1.8). UI Patterns (SDC in Drupal UI) 2.0.18 Minor update available for module ui_patterns (2.0.18). Search API Solr 4.3.11 Module search_api_solr updated after 14 months of inactivity (4.3.11). Provus Mega Menu Module provus_mega_menu crossed 1,000 active installs.

Postoffice

20 sites Security covered
View on drupal.org

The Postoffice module provides a clean API for developers to send themed emails using Symfony Mailer. It offers optional extensions to enhance email generation and integration with various Drupal features.

The Postoffice module sends themed emails with Symfony Mailer. This module provides a small, stable and clean API for developers to work with.

  • For details on how to use the API in a project, take a look at the guide and the examples
  • For a full description of the module, visit the project page
  • To submit bug reports and feature suggestions, or track changes, visit the issue tracker

Requirements

This module requires symfony/mailer 5 (for Drupal 9) or 6 (for Drupal 10). Optional extensions require additional composer libraries:

Installation

  • Install as you would normally install a contributed Drupal module. Visit the Installing Modules documentation page for further information.

Configuration

  • Change symfony mailer transport DSN and mail theme in Administration » Configuration » System » Postoffice settings
  • (Optional) Enable Postoffice Inline Styles module in order to inline styles from libraries referenced by templates into the generated markup.
  • (Optional) Enable Postoffice Html2Text module in order to generate a plain text part automatically.
  • (Optional) Enable Postoffice Skel module in order to wrap all HTML mails into a HTML document.
  • (Optional) Enable Postoffice Compat module and configure one or more of the included compatibility mail plugins:
    • (Optional) Send mails from the core user module using Postoffice:

      drush config:set system.mail interface.user postoffice_user_mail
    • (Optional) Send mails from the core contact module using Postoffice:

      drush config:set system.mail interface.contact postoffice_contact_mail
  • (Optional) Enable Postoffice Compat Theme module to ensure that all mail handled by core mail manager is rendered using the theme configured for Postoffice.
  • (Optional) Enable Postoffice Twig and use additional filters and functions in email twig templates:
    • postoffice_subject: Allows Twig templates to set a subject (usable as function and filter).
    • postoffice_text_body: Allows Twig templates to attach a text body part.
  • (Optional) Enable Postoffice Image and use additional filters and functions in email twig templates:
    • postoffice_image_embed: Embedds an image specified by its uri and optionally applies the given image style.
  • (Optional) Enable Postoffice File and use additional functions in email twig templates:
    • postoffice_file_attach_entity: Attaches a managed file entity.
    • postoffice_file_attach_uri: Attaches a file specified by its uri.

See Also

More contrib integration modules are developed in separate projects:

This module is geared towards developers. If it does not suit your modus operandi, please have a look at the Symfony Mailer module.

Maintainers

Current maintainers:

Activity

Total releases
3
First release
Mar 2025
Latest release
10 months ago
Releases (12 mo)
1 ▼ from 2
Maintenance
Slowing

Release Timeline

Releases

Version Type Release date
1.2.4 Stable Sep 4, 2025
1.2.3 Stable Apr 14, 2025
1.2.2 Stable Mar 7, 2025