symfony/google-mailer

Symfony Google Mailer Bridge

Maintainers

Package info

github.com/symfony/google-mailer

Homepage

Type:symfony-mailer-bridge

pkg:composer/symfony/google-mailer

Transparency log

Statistics

Installs: 6 155 170

Dependents: 31

Suggesters: 8

Stars: 127

v8.1.0 2026-05-29 05:06 UTC

This package is auto-updated.

Last update: 2026-08-02 09:30:58 UTC


README

Provides Google Gmail integration for Symfony Mailer.

Configuration example:

# SMTP
MAILER_DSN=gmail+smtp://USERNAME:APP-PASSWORD@default

# Gmail API, with OAuth2 service account authentication (domain-wide delegation)
MAILER_DSN=gmail+api://SERVICE-ACCOUNT-EMAIL:BASE64-ENCODED-PRIVATE-KEY@default?user=USER-EMAIL

For the gmail+api transport:

  • SERVICE-ACCOUNT-EMAIL is the service account e-mail address;
  • BASE64-ENCODED-PRIVATE-KEY is the service account RSA private key (PEM), base64-encoded so that it fits in the DSN (base64_encode($pem));
  • USER-EMAIL is the address of the user to impersonate, which is also the address the messages are sent from: the Gmail API always sends as the authenticated user, so a custom envelope sender is not supported.

Envelope

The Gmail API takes the recipients from the message itself, it has no envelope field. The envelope is therefore written into the headers of the message sent to Google: addresses it drops are removed from To and Cc, and the ones it adds travel in Bcc, which Gmail honors for delivery and strips from the delivered message. An envelope sender cannot be expressed, Gmail always sends as the impersonated user.

Sponsor

This package is looking for a backer.

Help Symfony by sponsoring its development!

Resources