-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Reworded the "How to use Gmail" cookbook article #5856
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
afd2305
Reworded the "How to use Gmail" cookbook article
javiereguiluz ac40aa1
Fixed the doc URL
javiereguiluz 270b203
Implemented all the recommended changes
javiereguiluz fdef6ea
Fixed YAML syntax issue
javiereguiluz ec59e77
Last round of reviews
javiereguiluz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,11 +8,6 @@ During development, instead of using a regular SMTP server to send emails, you | |
might find using Gmail easier and more practical. The SwiftmailerBundle makes | ||
it really easy. | ||
|
||
.. tip:: | ||
|
||
Instead of using your regular Gmail account, it's of course recommended | ||
that you create a special account. | ||
|
||
In the development configuration file, change the ``transport`` setting to | ||
``gmail`` and set the ``username`` and ``password`` to the Google credentials: | ||
|
||
|
@@ -55,33 +50,84 @@ In the development configuration file, change the ``transport`` setting to | |
'password' => 'your_gmail_password', | ||
)); | ||
|
||
You're done! | ||
If you are using the Symfony Standard Edition, it's more convenient to configure | ||
these options in the ``parameters.yml.dist`` file: | ||
|
||
.. tip:: | ||
.. code-block:: yaml | ||
|
||
If you are using the Symfony Standard Edition, configure the parameters in ``parameters.yml``: | ||
# app/config/parameters.yml.dist | ||
parameters: | ||
# ... | ||
mailer_user: your_gmail_username | ||
mailer_password: your_gmail_password | ||
|
||
.. configuration-block:: | ||
|
||
.. code-block:: yaml | ||
|
||
# app/config/parameters.yml | ||
parameters: | ||
# ... | ||
mailer_transport: gmail | ||
mailer_host: ~ | ||
mailer_user: your_gmail_username | ||
mailer_password: your_gmail_password | ||
# app/config/config_dev.yml | ||
swiftmailer: | ||
transport: gmail | ||
username: '%mailer_user%' | ||
password: '%mailer_password%' | ||
|
||
.. code-block:: xml | ||
|
||
<!-- app/config/config_dev.xml --> | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<container xmlns="http://symfony.com/schema/dic/services" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:swiftmailer="http://symfony.com/schema/dic/swiftmailer" | ||
xsi:schemaLocation="http://symfony.com/schema/dic/services | ||
http://symfony.com/schema/dic/services/services-1.0.xsd | ||
http://symfony.com/schema/dic/swiftmailer | ||
http://symfony.com/schema/dic/swiftmailer/swiftmailer-1.0.xsd"> | ||
|
||
<!-- ... --> | ||
<swiftmailer:config | ||
transport="gmail" | ||
username="%mailer_user%" | ||
password="%mailer_password%" | ||
/> | ||
</container> | ||
|
||
.. code-block:: php | ||
|
||
// app/config/config_dev.php | ||
$container->loadFromExtension('swiftmailer', array( | ||
'transport' => 'gmail', | ||
'username' => '%mailer_user%', | ||
'password' => '%mailer_password%', | ||
)); | ||
|
||
Redefining the Default Configuration Parameters | ||
----------------------------------------------- | ||
|
||
The ``gmail`` transport is simply a shortcut that uses the ``smtp`` transport | ||
and sets these options: | ||
|
||
============== ================== | ||
Option Value | ||
============== ================== | ||
``encryption`` ``ssl`` | ||
``auth_mode`` ``login`` | ||
``host`` ``smtp.gmail.com`` | ||
============== ================== | ||
|
||
If your application uses ``tls`` encryption or ``oauth`` authentication, you | ||
must override the default options by defining the ``encryption`` and ``auth_mode`` | ||
parameters. | ||
|
||
.. note:: | ||
If you are using 2-Step-Verification, you must `generate an App password`_ and | ||
use this as your ``mailer_password`` value. | ||
|
||
The ``gmail`` transport is simply a shortcut that uses the ``smtp`` transport | ||
and sets ``encryption``, ``auth_mode`` and ``host`` to work with Gmail. | ||
If your Gmail account uses 2-Step-Verification, you must `generate an App password`_ | ||
and use it as the value of the ``mailer_password`` parameter. You must also ensure | ||
that you `allow less secure apps to access your Gmail account`_. | ||
|
||
.. note:: | ||
.. seealso:: | ||
|
||
Depending on your Gmail account settings, you may get authentication errors | ||
within your app. If your Gmail account uses 2-Step-Verification, you should | ||
`generate an App password`_ to use for your ``mailer_password`` parameter. | ||
You should also ensure that you `allow less secure apps to access your Gmail account`_. | ||
:doc:`Swiftmailer configuration reference </reference/configuration/swiftmailer>` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would have kept the sentence though: .. seealso::
See the :doc:`Swiftmailer configuration reference </reference/configuration/swiftmailer>`
for more details. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But we can make that change when merging. The PR so far looks ready to me. 👍 |
||
|
||
.. _`generate an App password`: https://support.google.com/accounts/answer/185833 | ||
.. _`allow less secure apps to access your Gmail account`: https://support.google.com/accounts/answer/6010255 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's the cookbook, so we can assume they are and we can say "It's more convenient to configure these options in the
parameters.yml.dist
file:"There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually, should be
parameters.yml