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_oauth2

324 sites No security coverage
View on drupal.org

Looking for new maintainer

See #3365216: PHPMailer OAuth2 Looking for new maintainer.

Overview and configuration

Provides basic OAuth2 support for PHPMailer SMTP.

It currently only supports Azure authentication. Because Microsoft does not support client credentials flow for SMTP (yet), occasional manual updates of the auth and refresh token may be required.

Configuration is at: Config -> System -> PHPMailer OAuth2

Enter your settings and click "Save Configuration". Once it has been saved, click "Get auth token" to get new auth and refresh tokens.

Once enabled, set the Authentication Type within PHPMailer SMTP.

The redirect path to provide to Azure is /phpmailer_oauth2/aad-callback. For example:

https://www.example.com/phpmailer_oauth2/aad-callback

Install with composer.

composer require drupal/phpmailer_oauth2

Other providers

Review the code in the module to find out how it works so you can implement your own provider. This could be a stand-alone module or included within this module.

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.

Alternatives

Gmail OAuth2 Client apparently uses OAuth2 Client and integrates with PHPMailer SMTP.

Many email services are recommending the use of their APIs instead of SMTP for sending email. The Pantheon hosting platform also recommends this approach.

There are a few modules for specific services.

Activity

Total releases
3
First release
Oct 2025
Latest release
5 months ago
Release cadence
0 days
Stability
0% stable

Release Timeline

Releases

Version Type Release date
2.0.0-alpha2 Pre-release Oct 21, 2025
2.0.0-alpha1 Pre-release Oct 21, 2025
2.0.x-dev Dev Oct 21, 2025