-
-
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
Changes from 2 commits
afd2305
ac40aa1
270b203
fdef6ea
ec59e77
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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,73 @@ 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 parameters in ``parameters.yml``: | ||
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. "these parameters" seems wrong, as we never talked about parameters before in this article. What about: "If you're using the Symfony Standard Edition, it's more convenient to use parameters for these options:" 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. ...to use parameters.yml for these options...? |
||
|
||
.. tip:: | ||
.. code-block:: yaml | ||
|
||
If you are using the Symfony Standard Edition, configure the parameters in ``parameters.yml``: | ||
# app/config/parameters.yml | ||
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 wonder if this shouldn't be put in 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. maybe adding a note/tip to add this in the dist file too? |
||
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% | ||
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. double quotes are needed in these 2 lines ( 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. We should use single quotes instead. 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. Thanks for the heads up. I've updated this. Hopefully this PR can now be considered finished. |
||
|
||
.. 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 | ||
----------------------------------------------- | ||
|
||
.. note:: | ||
The ``gmail`` transport is simply a shortcut that uses the ``smtp`` transport | ||
and sets ``encryption`` to ``ssl``, ``auth_mode`` to ``login`` and ``host`` to | ||
``smtp.gmail.com`` to work with Gmail. | ||
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. what about using a table here for the options? |
||
|
||
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 application uses ``tls`` encryption or ``oauth`` authentication, you | ||
must override the default options by defining the ``encryption`` and ``auth_mode`` | ||
parameters. | ||
|
||
.. note:: | ||
If your Gmail account uses 2-Step-Verification, you must `generate an App password`_ | ||
to use for your ``mailer_password`` parameter. You must also ensure that you | ||
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.
sounds weird, what about:
|
||
`allow less secure apps to access your Gmail account`_. | ||
|
||
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`_. | ||
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. I would wrap this in a |
||
|
||
.. _`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 |
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