@@ -37,9 +37,6 @@ environment variable in the ``.env`` file:
3737# use this to disable email delivery
3838 MAILER_URL=null://localhost
3939
40- # use this to send emails via Gmail (don't use this in production)
41- MAILER_URL=gmail://username:password@localhost
42-
4340# use this to configure a traditional SMTP server
4441 MAILER_URL=smtp://localhost:25? encryption=ssl& auth_mode=login& username=& password=
4542
@@ -107,15 +104,56 @@ The ``$message`` object supports many more options, such as including attachment
107104adding HTML content, and much more. Refer to the `Creating Messages `_ section
108105of the Swift Mailer documentation for more details.
109106
107+ Using Gmail to Send Emails
108+ --------------------------
109+
110+ During development, you might prefer to send emails using Gmail instead of
111+ setting up a regular SMTP server. To do that, update the ``MAILER_URL `` of your
112+ ``.env `` file to this:
113+
114+ ..code-block ::bash
115+
116+ # username is your full Gmail or Google Apps email address
117+ MAILER_URL=gmail://username:password@localhost
118+
119+ The ``gmail `` transport is simply a shortcut that uses the ``smtp `` transport,
120+ ``ssl `` encryption, ``login `` auth mode and ``smtp.gmail.com `` host. If your app
121+ uses other encryption or auth mode, you must override those values
122+ (:doc: `see mailer config reference </reference/configuration/swiftmailer >`):
123+
124+ ..code-block ::bash
125+
126+ # username is your full Gmail or Google Apps email address
127+ MAILER_URL=gmail://username:password@localhost? encryption=tls& auth_mode=oauth
128+
129+ If your Gmail account uses 2-Step-Verification, you must `generate an App password `_
130+ and use it as the value of the mailer password. You must also ensure that you
131+ `allow less secure apps to access your Gmail account `_.
132+
133+ Using Cloud Services to Send Emails
134+ -----------------------------------
135+
136+ Cloud mailing services are a popular option for companies that don't want to set
137+ up and maintain their own reliable mail servers. In Symfony apps, using these
138+ services is as simple as updating the value of ``MAILER_URL `` in the ``.env ``
139+ file. For example, for `Amazon SES `_ (Simple Email Service):
140+
141+ ..code-block ::bash
142+
143+ # The host will be different depending on your AWS zone
144+ # The username/password credentials are obtained from the Amazon SES console
145+ MAILER_URL=smtp://email-smtp.us-east-1.amazonaws.com:587? encryption=tls& username=YOUR_SES_USERNAME& password=YOUR_SES_PASSWORD
146+
147+ Use the same technique for other mail services, as most of the time there is
148+ nothing more to it than configuring an SMTP endpoint.
149+
110150Learn more
111151----------
112152
113153..toctree ::
114154:maxdepth: 1
115155
116156email/dev_environment
117- email/gmail
118- email/cloud
119157email/spool
120158email/testing
121159
@@ -125,3 +163,5 @@ Learn more
125163.. _`Mandrill` :https://mandrill.com/
126164.. _`SendGrid` :https://sendgrid.com/
127165.. _`Amazon SES` :http://aws.amazon.com/ses/
166+ .. _`generate an App password` :https://support.google.com/accounts/answer/185833
167+ .. _`allow less secure apps to access your Gmail account` :https://support.google.com/accounts/answer/6010255