Table of Contents
By default, only the production environment (master) can send emails. Outgoing emails need to be explicitly enabled for all other environments:
$ symfony env:setting:set smtp on --env=some-env
Check if outgoing emails are enabled for the current environment by using
$ symfony env:settings
The configuration is exposed via the following environment variables:
MAILER_ENABLED: 1 if outgoing emails are enabled, 0 otherwise
MAILER_URL: The Symfony-compatible mailer URL
MAILER_HOST: The SMTP server host
MAILER_PORT: The SMTP server port
MAILER_TRANSPORT: The SMTP transport mode (
MAILER_AUTH_MODE: The SMTP auth mode (
MAILER_USER: The SMTP server user
MAILER_PASSWORD: The SMTP server password
On Symfony projects using Flex, install Symfony Mailer:
$ composer require mailer
No further configuration is needed as the default configuration knows how to
use the value of
MAILER_URL is also provided for backward-compatiblity with
For other applications, use
MAILER_DSN with Symfony Mailer or use the
MAILER_* environment variables to configure your framework of choice.
Avoid using the PHP built-in
mail() function to send emails. Even if the
PHP runtime is configured to send email via the assigned SendGrid
mail() is known to be difficult to secure depending on the
Emails from SymfonyCloud are sent via a SendGrid-based SMTP proxy. Each SymfonyCloud project is provisioned as a SendGrid sub-account. These SendGrid sub-accounts are capped at 12k emails per month.
We do not guarantee the deliverability of emails, and we do not support white-labeling them. Our SMTP proxy is intended as a zero-configuration, best effort service. If needed, you can instead use your own SMTP server or email delivery service provider. In that case, please bear in mind that TCP port 25 is blocked for security reasons; use TCP port 465 or 587 instead.
You may follow the SPF setup guidelines on SendGrid to improve email deliverability with our SMTP proxy.