This document explains how to use the various mailer transports that are included in the phpList core dependencies:
- Google Mailer (Gmail)
- Amazon SES
- Mailchimp Transactional (Mandrill)
- SendGrid
The phpList core uses Symfony Mailer for sending emails. The mailer transport is configured using the MAILER_DSN environment variable, which is defined in config/parameters.yml.
To use Gmail as your email transport:
# Using Gmail with OAuth (recommended)
MAILER_DSN=gmail://USERNAME:APP_PASSWORD@default
# Using Gmail with SMTP
MAILER_DSN=smtp://USERNAME:PASSWORD@smtp.gmail.com:587
Notes:
- Replace
USERNAMEwith your Gmail address - For OAuth setup, follow Symfony Gmail documentation
- For the SMTP method, you may need to enable "Less secure app access" or use an App Password
To use Amazon SES:
# Using API credentials
MAILER_DSN=ses://ACCESS_KEY:SECRET_KEY@default?region=REGION
# Using SMTP interface
MAILER_DSN=smtp://USERNAME:PASSWORD@email-smtp.REGION.amazonaws.com:587
Notes:
- Replace
ACCESS_KEYandSECRET_KEYwith your AWS credentials - Replace
REGIONwith your AWS region (e.g., us-east-1) - For SMTP, use the credentials generated in the Amazon SES console
To use Mailchimp Transactional (formerly Mandrill):
MAILER_DSN=mandrill://API_KEY@default
Notes:
- Replace
API_KEYwith your Mailchimp Transactional API key - You can find your API key in the Mailchimp Transactional (Mandrill) dashboard
To use SendGrid:
# Using API
MAILER_DSN=sendgrid://API_KEY@default
# Using SMTP
MAILER_DSN=smtp://apikey:API_KEY@smtp.sendgrid.net:587
Notes:
- Replace
API_KEYwith your SendGrid API key - For SMTP, the username is literally "apikey" and the password is your actual API key
After setting up your preferred mailer transport, you can test it using the built-in test command:
bin/console phplist:test-email recipient@example.comYou can easily switch between different mailer transports by changing the MAILER_DSN environment variable. This can be done in several ways:
- Edit the
config/parameters.ymlfile directly - Set the environment variable in your server configuration
- Set the environment variable before running a command:
MAILER_DSN=sendgrid://API_KEY@default bin/console phplist:test-email recipient@example.com
Some transports may require additional configuration options. Refer to the Symfony documentation for more details: