-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[Cookbook] New cookbok: How to use the Cloud to send Emails #3234
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 1 commit
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 |
---|---|---|
@@ -0,0 +1,110 @@ | ||
.. index:: | ||
single: Emails; Cloud | ||
|
||
How to use the Cloud to send Emails | ||
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 I'm wrong but shouldn't this be "How to Use the Cloud to Send E-Mails" according to our new guidelines? 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. At least I prefer E-Mail over Email 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've used the Gmail cookbook as a base for this one.
Btw, I've found a lot of such words that are spelled differently across the docs; I'll create an issue listing them, we could vote for the correct one and then I'll update the docs. |
||
=================================== | ||
|
||
Requirements for sending emails from a production system differ from your | ||
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. e-mails |
||
development setup as you don't want to be limited in the number of emails, | ||
the sending rate or the sender address. Thus, | ||
:doc:`using Gmail </cookbook/email/gmail>`_ or similar services is not an | ||
option. If setting up and maintaining your own reliable mail server causes | ||
you a headache there's a simple solution: Leverage the cloud to send your | ||
emails. | ||
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. same here |
||
|
||
The following example shows how easy it is to integrate | ||
`Amazon's Simple Email Services (SES)`_ into Symfony. But no matter what | ||
service you're actually using, there's nothing more to it than configuring an | ||
SMTP endpoint for Swift Mailer. | ||
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 think this should b placed in a.note 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. Do you mean the The following example shows... paragraph only? 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. Yes 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. Doesn't that look a bit strange, because actually all that follows builds upon the introduction of SES (in the note then)? I think maybe the sentence But no matter what .. should be placed in a note because it is an independent notice. 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. hmm, yes indeed. Something like: This article shows how easy it is to integrate `Amazon's Simple Email Services (SES)`_
into the Symfony Framework.
.. note::
You can use the same technique for other mail services, as most of the time there is
nothing more to it than configuring an SMTP endpoint for Swift Mailer. |
||
|
||
In the Symfony configuration, change the Swift Mailer settings ``transport``, | ||
``host``, ``port`` and ``encryption`` according to the information provided in | ||
the `SES console`_. Create your individual SMTP credentials in the SES console | ||
and complete the configuration with the provided ``username`` and ``password``: | ||
|
||
.. configuration-block:: | ||
|
||
.. code-block:: yaml | ||
|
||
# app/config/config.yml | ||
swiftmailer: | ||
transport: smtp | ||
host: email-smtp.us-east-1.amazonaws.com | ||
port: 465 # different ports are available, see SES console | ||
encryption: tls # TLS encryption is required | ||
username: AWS_ACCESS_KEY # to be created in the SES console | ||
password: AWS_SECRET_KEY # to be created in the SES console | ||
|
||
.. code-block:: xml | ||
|
||
<!-- app/config/config.xml --> | ||
|
||
<!-- | ||
xmlns:swiftmailer="http://symfony.com/schema/dic/swiftmailer" | ||
http://symfony.com/schema/dic/swiftmailer http://symfony.com/schema/dic/swiftmailer/swiftmailer-1.0.xsd | ||
--> | ||
|
||
<swiftmailer:config | ||
transport="smtp" | ||
host="email-smtp.us-east-1.amazonaws.com" | ||
port="465" | ||
encryption="tls" | ||
username="AWS_ACCESS_KEY" | ||
password="AWS_SECRET_KEY" /> | ||
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. is there any reason to not provide a complete and valid XML configuration? 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. This also comes from the Gmail cookbook, so I should update both then. |
||
|
||
.. code-block:: php | ||
|
||
// app/config/config.php | ||
$container->loadFromExtension('swiftmailer', array( | ||
'transport' => "smtp", | ||
'host' => "email-smtp.us-east-1.amazonaws.com", | ||
'port' => 465, | ||
'encryption' => "tls", | ||
'username' => "AWS_ACCESS_KEY", | ||
'password' => "AWS_SECRET_KEY", | ||
)); | ||
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. $container->loadFromExtension('swiftmailer', array(
'transport' => 'smtp',
'host' => 'email-smtp.us-east-1.amazonaws.com',
'port' => 465,
'encryption' => 'tls',
'username' => 'AWS_ACCESS_KEY',
'password' => 'AWS_SECRET_KEY',
)); |
||
|
||
The ``port`` and ``encryption`` keys are not present in the Symfony Standard | ||
Edition configuration by default, but you can simply add them as needed. | ||
|
||
And that's it, you're ready to start sending emails through the cloud! | ||
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. e-mails |
||
|
||
.. tip:: | ||
|
||
If you are using the Symfony Standard Edition, configure the parameters at | ||
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. in |
||
``parameters.yml`` and use them in your configuration files. This allows | ||
for different Swift Mailer configurations for each installation of your | ||
application. For instance, use Gmail during development and the cloud in | ||
production. | ||
|
||
.. code-block:: yaml | ||
|
||
# app/config/parameters.yml | ||
parameters: | ||
# ... | ||
mailer_transport: smtp | ||
mailer_host: email-smtp.us-east-1.amazonaws.com | ||
mailer_port: 465 # different ports are available, see SES console | ||
mailer_encryption: tls # TLS encryption is required | ||
mailer_user: AWS_ACCESS_KEY # to be created in the SES console | ||
mailer_password: AWS_SECRET_KEY # to be created in the SES console | ||
|
||
.. note:: | ||
|
||
If you intend to use Amazon SES, please note the following: | ||
|
||
* You have to sign up to `Amazon Web Services (AWS)`_; | ||
|
||
* Every sender address used in the ``From`` or ``ReturnPath`` (bounce | ||
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.
|
||
address) header needs to be confirmed by the owner. You can also | ||
confirm an entire domain; | ||
|
||
* Initially you are in a restricted sandbox mode. You need to request | ||
production access before being allowed to send to arbitrary | ||
recipients; | ||
|
||
* SES may be subject to a charge. | ||
|
||
.. _`Amazon's Simple Email Services (SES)`: http://aws.amazon.com/ses | ||
.. _`SES console`: https://console.aws.amazon.com/ses | ||
.. _`Amazon Web Services (AWS)`: http://aws.amazon.com |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,6 +66,7 @@ | |
|
||
* :doc:`/cookbook/email/email` | ||
* :doc:`/cookbook/email/gmail` | ||
* :doc:`/cookbook/email/cloud` | ||
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. should also be added to 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. Done, thanks! |
||
* :doc:`/cookbook/email/dev_environment` | ||
* :doc:`/cookbook/email/spool` | ||
* :doc:`/cookbook/email/testing` | ||
|
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.
Cloud -> Using the cloud ?