Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3490722

Browse files
committed
[Cookbook] New cookbok: How to use the Cloud to send Emails
1 parentf14ef95 commit3490722

File tree

2 files changed

+111
-0
lines changed

2 files changed

+111
-0
lines changed

‎cookbook/email/cloud.rst‎

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
..index::
2+
single: Emails; Cloud
3+
4+
How to use the Cloud to send Emails
5+
===================================
6+
7+
Requirements for sending emails from a production system differ from your
8+
development setup as you don't want to be limited in the number of emails,
9+
the sending rate or the sender address. Thus,
10+
:doc:`using Gmail</cookbook/email/gmail>`_ or similar services is not an
11+
option. If setting up and maintaining your own reliable mail server causes
12+
you a headache there's a simple solution: Leverage the cloud to send your
13+
emails.
14+
15+
The following example shows how easy it is to integrate
16+
`Amazon's Simple Email Services (SES)`_ into Symfony. But no matter what
17+
service you're actually using, there's nothing more to it than configuring an
18+
SMTP endpoint for Swift Mailer.
19+
20+
In the Symfony configuration, change the Swift Mailer settings ``transport``,
21+
``host``, ``port`` and ``encryption`` according to the information provided in
22+
the `SES console`_. Create your individual SMTP credentials in the SES console
23+
and complete the configuration with the provided ``username`` and ``password``:
24+
25+
..configuration-block::
26+
27+
..code-block::yaml
28+
29+
# app/config/config.yml
30+
swiftmailer:
31+
transport:smtp
32+
host:email-smtp.us-east-1.amazonaws.com
33+
port:465# different ports are available, see SES console
34+
encryption:tls# TLS encryption is required
35+
username:AWS_ACCESS_KEY# to be created in the SES console
36+
password:AWS_SECRET_KEY# to be created in the SES console
37+
38+
..code-block::xml
39+
40+
<!-- app/config/config.xml-->
41+
42+
<!--
43+
xmlns:swiftmailer="http://symfony.com/schema/dic/swiftmailer"
44+
http://symfony.com/schema/dic/swiftmailer http://symfony.com/schema/dic/swiftmailer/swiftmailer-1.0.xsd
45+
-->
46+
47+
<swiftmailer:config
48+
transport="smtp"
49+
host="email-smtp.us-east-1.amazonaws.com"
50+
port="465"
51+
encryption="tls"
52+
username="AWS_ACCESS_KEY"
53+
password="AWS_SECRET_KEY" />
54+
55+
..code-block::php
56+
57+
// app/config/config.php
58+
$container->loadFromExtension('swiftmailer', array(
59+
'transport' => "smtp",
60+
'host' => "email-smtp.us-east-1.amazonaws.com",
61+
'port' => 465,
62+
'encryption' => "tls",
63+
'username' => "AWS_ACCESS_KEY",
64+
'password' => "AWS_SECRET_KEY",
65+
));
66+
67+
The ``port`` and ``encryption`` keys are not present in the Symfony Standard
68+
Edition configuration by default, but you can simply add them as needed.
69+
70+
And that's it, you're ready to start sending emails through the cloud!
71+
72+
..tip::
73+
74+
If you are using the Symfony Standard Edition, configure the parameters at
75+
``parameters.yml`` and use them in your configuration files. This allows
76+
for different Swift Mailer configurations for each installation of your
77+
application. For instance, use Gmail during development and the cloud in
78+
production.
79+
80+
..code-block::yaml
81+
82+
# app/config/parameters.yml
83+
parameters:
84+
# ...
85+
mailer_transport:smtp
86+
mailer_host:email-smtp.us-east-1.amazonaws.com
87+
mailer_port:465# different ports are available, see SES console
88+
mailer_encryption:tls# TLS encryption is required
89+
mailer_user:AWS_ACCESS_KEY# to be created in the SES console
90+
mailer_password:AWS_SECRET_KEY# to be created in the SES console
91+
92+
..note::
93+
94+
If you intend to use Amazon SES, please note the following:
95+
96+
* You have to sign up to `Amazon Web Services (AWS)`_;
97+
98+
* Every sender address used in the ``From`` or ``ReturnPath`` (bounce
99+
address) header needs to be confirmed by the owner. You can also
100+
confirm an entire domain;
101+
102+
* Initially you are in a restricted sandbox mode. You need to request
103+
production access before being allowed to send to arbitrary
104+
recipients;
105+
106+
* SES may be subject to a charge.
107+
108+
.. _`Amazon's Simple Email Services (SES)`:http://aws.amazon.com/ses
109+
.. _`SES console`:https://console.aws.amazon.com/ses
110+
.. _`Amazon Web Services (AWS)`:http://aws.amazon.com

‎cookbook/map.rst.inc‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666

6767
* :doc:`/cookbook/email/email`
6868
* :doc:`/cookbook/email/gmail`
69+
* :doc:`/cookbook/email/cloud`
6970
* :doc:`/cookbook/email/dev_environment`
7071
* :doc:`/cookbook/email/spool`
7172
* :doc:`/cookbook/email/testing`

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp