How to configure mailer?¶

There are many services used for sending transactional emails in web applications. You can find for instance Mailjet, Mandrill or SendGrid among them.

In Sylius emails are configured the Symfony way, so you can get inspired by the Symfony guides to those mailing services.

We are recommending to use Symfony Mailer where out of the box, you can deliver emails by configuring the MAILER_DSN variable in your .env file.

If you prefer using the SwiftMailer service you will need to:

  1. Create an account on a mailing service.
  2. In the your .env file modify/add the MAILER_URL variable.
MAILER_URL=gmail://username:password@localhost

Emails delivery is disable for test, dev and stage environments by default. The prod environment has delivery turned on by default, so there is nothing to worry about if you did not change anything about it.

That’s pretty much all! All the other issues are dependent on the service you are using.

Warning

Remember that the parameters like username or password must not be committed publicly to your repository. Save them as environment variables on your server.