-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Move to the new DSN format for Mailer #12258
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
Merged
Merged
Changes from all commits
Commits
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 |
---|---|---|
|
@@ -85,26 +85,44 @@ DSN:: | |
$transport = Transport::fromDsn($dsn); | ||
|
||
Where ``$dsn`` depends on the provider you want to use. For plain SMTP, use | ||
``smtp://user:[email protected]`` or ``smtp://sendmail`` to use the ``sendmail`` | ||
binary. For third-party providers, refers to the following table: | ||
|
||
==================== ================================== ================================== ================================ | ||
Provider SMTP HTTP API | ||
==================== ================================== ================================== ================================ | ||
Amazon SES smtp://ACCESS_KEY:SECRET_KEY@ses http://ACCESS_KEY:SECRET_KEY@ses api://ACCESS_KEY:SECRET_KEY@ses | ||
Google Gmail smtp://USERNAME:PASSWORD@gmail n/a n/a | ||
Mailchimp Mandrill smtp://USERNAME:PASSWORD@mandrill http://KEY@mandrill api://KEY@mandrill | ||
Mailgun smtp://USERNAME:PASSWORD@mailgun http://KEY:DOMAIN@mailgun api://KEY:DOMAIN@mailgun | ||
Postmark smtp://ID:ID@postmark n/a api://KEY@postmark | ||
Sendgrid smtp://apikey:KEY@sendgrid n/a api://KEY@sendgrid | ||
==================== ================================== ================================== ================================ | ||
``smtp://user:[email protected]`` or ``sendmail+smtp://default`` to use the | ||
``sendmail`` binary. To disable the transport, use ``null://null``. | ||
|
||
For third-party providers, refers to the following table: | ||
|
||
==================== ========================================== =========================================== ======================================== | ||
Provider SMTP HTTP API | ||
==================== ========================================== =========================================== ======================================== | ||
Amazon SES ses+smtp://ACCESS_KEY:SECRET_KEY@default ses+https://ACCESS_KEY:SECRET_KEY@default ses+api://ACCESS_KEY:SECRET_KEY@default | ||
Google Gmail gmail+smtp://USERNAME:PASSWORD@default n/a n/a | ||
Mailchimp Mandrill mandrill+smtp://USERNAME:PASSWORD@default mandrill+https://KEY@default mandrill+api://KEY@default | ||
Mailgun mailgun+smtp://USERNAME:PASSWORD@default mailgun+https://KEY:DOMAIN@default mailgun+api://KEY:DOMAIN@default | ||
Postmark postmark+smtp://ID:ID@default n/a postmark+api://KEY@default | ||
Sendgrid sendgrid+smtp://apikey:KEY@default n/a sendgrid+api://KEY@default | ||
==================== ========================================== =========================================== ======================================== | ||
|
||
Instead of choosing a specific protocol, you can also let Symfony pick the | ||
"best" one by omitting it from the scheme: for instance, | ||
``mailgun://KEY:DOMAIN@default`` is equivalent to | ||
``mailgun+https://KEY:DOMAIN@default``. | ||
|
||
If you want to override the default host for a provider (to debug an issue with | ||
a requestb.in like service), change ``default`` by your host: | ||
|
||
|
||
.. code-block:: bash | ||
|
||
mailgun+https://KEY:[email protected] | ||
mailgun+https://KEY:[email protected]:99 | ||
|
||
Note that the protocol is *always* HTTPs and cannot be changed. | ||
|
||
Failover Transport | ||
------------------ | ||
|
||
You can create failover transport with the help of `||` operator:: | ||
|
||
$dsn = 'api://id@postmark || smtp://key@sendgrid'; | ||
$dsn = 'postmark+api://ID@default || sendgrid+smtp://KEY@default'; | ||
|
||
So if the first transport fails, the mailer will attempt to send through the | ||
second transport. | ||
|
@@ -115,7 +133,7 @@ Round Robin | |
If you want to send emails by using multiple transports in a round-robin fashion, | ||
you can use the ``&&`` operator between the transports:: | ||
|
||
$dsn = 'api://id@postmark && smtp://key@sendgrid' | ||
$dsn = 'postmark+api://ID@default && sendgrid+smtp://KEY@default'; | ||
|
||
Sending emails asynchronously | ||
----------------------------- | ||
|
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
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.
Uh oh!
There was an error while loading. Please reload this page.