Symfony Google Mailer

Gmail SMTP transport bridge for Symfony Mailer, configured through a single DSN.

SDK
Composer
vv8.1.0
127stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
65/100Good
Development Activity56
Maintenance68
Community56
Maturity60
Momentum20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
67/100Good
Architecture65
Code Quality62
Innovation55
Learning Curve85

Symfony Google Mailer is a small bridge package that plugs Gmail’s SMTP servers into Symfony Mailer as a first-class transport. Rather than manually configuring an SMTP transport with Gmail’s host, port, and TLS settings, developers set MAILER_DSN=gmail+smtp://USERNAME:APP-PASSWORD@default and Symfony Mailer routes mail through smtp.gmail.com:465 automatically.

It’s one of many symfony/*-mailer bridge packages (alongside Mailgun, Postmark, SendGrid, etc.) that let applications swap mail providers by changing a DSN string instead of transport wiring code.

What You Get

  • GmailTransportFactory recognizing gmail, gmail+smtp, and gmail+smtps DSN schemes
  • GmailSmtpTransport pre-wired to smtp.gmail.com:465 with implicit TLS
  • Drop-in integration with Symfony Mailer’s existing MAILER_DSN configuration convention
  • Optional PSR-14 event dispatcher and PSR-3 logger wiring inherited from EsmtpTransport

Common Use Cases

  • Symfony applications that want to send transactional or notification email through a personal or Workspace Gmail account
  • Small projects or internal tools that don’t warrant a dedicated transactional email provider
  • Swapping between Gmail and another provider by changing only the MAILER_DSN environment variable

Under The Hood

Architecture — The bridge follows Symfony Mailer’s transport-factory pattern: GmailTransportFactory extends AbstractTransportFactory and implements getSupportedSchemes() plus create(), which builds a GmailSmtpTransport from the DSN’s username/password. GmailSmtpTransport itself is a thin subclass of EsmtpTransport, hard-coding the Gmail SMTP host, port 465, and implicit TLS in its constructor, then delegating everything else — message building, envelope handling, connection management — to the parent ESMTP implementation.

Tech Stack — PHP 8.4+, PSR-4 autoloaded under Symfony\Component\Mailer\Bridge\Google. Its only hard dependency is symfony/mailer (^7.4|^8.0); symfony/http-client is a dev-only dependency used for the factory’s test suite.

Code Quality — A single test file, Tests/Transport/GmailTransportFactoryTest.php, covers scheme recognition and transport creation via PHPUnit. The actual SMTP transport logic is inherited from Symfony Mailer’s well-tested EsmtpTransport, so this package’s own footprint is small and low-risk by design.

API Design — Zero code changes are required to adopt it beyond installing the package and setting a DSN string — gmail+smtp://USERNAME:APP-PASSWORD@default — which Symfony Mailer resolves automatically via its transport factory registry. The password field expects a Gmail App Password rather than the account password, consistent with Google’s SMTP authentication requirements.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search