Drupal is a registered trademark of Dries Buytaert
drupal 11.3.7 Update released for Drupal core (11.3.7)! drupal 11.2.11 Update released for Drupal core (11.2.11)! drupal 10.6.7 Update released for Drupal core (10.6.7)! drupal 10.5.9 Update released for Drupal core (10.5.9)! cms 2.1.1 Update released for Drupal core (2.1.1)! drupal 11.3.6 Update released for Drupal core (11.3.6)! drupal 10.6.6 Update released for Drupal core (10.6.6)! cms 2.1.0 Update released for Drupal core (2.1.0)! bootstrap 8.x-3.40 Minor update available for theme bootstrap (8.x-3.40). menu_link_attributes 8.x-1.7 Minor update available for module menu_link_attributes (8.x-1.7). eca 3.1.1 Minor update available for module eca (3.1.1). layout_paragraphs 2.1.3 Minor update available for module layout_paragraphs (2.1.3). ai 1.3.3 Minor update available for module ai (1.3.3). ai 1.2.14 Minor update available for module ai (1.2.14). node_revision_delete 2.0.3 Minor update available for module node_revision_delete (2.0.3). moderated_content_bulk_publish 2.0.52 Minor update available for module moderated_content_bulk_publish (2.0.52). klaro 3.0.10 Minor update available for module klaro (3.0.10). klaro 3.0.9 Minor update available for module klaro (3.0.9). layout_paragraphs 2.1.2 Minor update available for module layout_paragraphs (2.1.2). geofield_map 11.1.8 Minor update available for module geofield_map (11.1.8).

phpmailer_smtp

11,155 sites Security covered
View on drupal.org

Send emails via SMTP using the latest PHPMailer library.

The only requirements are the Mail System module and an SMTP service.

Features

  • Send email via SMTP using an external service
  • Supports HTML emails, attachments and inline images
  • RFC compliant ensuring robust email delivery
  • Doesn't reinvent the wheel - uses the PHPMailer library wherever possible
  • Debugging options
  • Advanced SMTP settings

Requirements

  • Access to an SMTP server
  • The Mail System module.
  • PHPMailer library - installed via composer, see below

Installation

composer require drupal/phpmailer_smtp

This installs the module and the PHPMailer library. Enable the module as usual.

If you can't use composer Ludwig is supported.

Configuration

Configure PHPMailer SMTP

SMTP server configuration

Administer -> Configuration -> System -> PHPMailer SMTP

The most secure port is 465 which uses implicit encryption so no part of the communication is in plain text. For this port, select "SSL/TLS" as the encryption protocol.

The "STARTTLS" option is used to upgrade a plain text connection to use TLS. This is used with port 587 which requires an explicit request to change to an encrypted connection and is less secure than the fully encrypted connection on port 465.

Email format

Administer -> Configuration -> System -> PHPMailer SMTP -> Format

Selecting "Plain text" will force all emails to be plain text.

Install and Configure Mail System

composer require drupal/mailsystem

Enable the mail system module then configure:

Administer -> Configuration -> System -> Mail System.

Select "PHPMailer SMTP" as "Sender" under "Default Mail System" and "Module-Specific Configuration" as required.

Select "PHPMailer SMTP" as the Formatter

OAuth2

OAuth2 is supported via basic plugins. For an example using Azure, see PHPMailer OAuth2. Review the code in the module to find out how it works so you can implement your own provider.

The PHPMailer library supports league/oauth2-client providers:

As of PHPMailer 6.6.0, the library now accepts anything that implements the OAuthProviderInterface. This includes Google's OAuth classes.

Optional

Performance

To improve performance on page load emails can be queued prior to sending.

  • Queue Mail will queue emails which can then be sent later on a cron run.
  • Ultimate Cron allows for fine-grained control over cron runs. For example using Queue Mail, email can be stored and sent sent every minute while other tasks are performed once an hour.

Security

For better security, SMTP credentials can be stored outside normal config.

Activity

Total releases
6
First release
Jan 2025
Latest release
5 months ago
Release cadence
57 days
Stability
50% stable

Release Timeline

Releases

Version Type Release date
2.4.x-dev Dev Oct 22, 2025
2.4.0 Stable Oct 15, 2025
2.3.1 Stable Oct 5, 2025
2.3.0 Stable Sep 10, 2025
2.3.0-beta1 Pre-release Apr 29, 2025
2.3.x-dev Dev Jan 9, 2025