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

[Mailer] Complete mailer documentation#14565

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
wouterj merged 1 commit intosymfony:4.4froml-vo:complete_mailer_integration_4.4
Nov 21, 2020
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletionsmailer.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -29,11 +29,58 @@ over SMTP by configuring the DSN in your ``.env`` file (the ``user``,
# .env
MAILER_DSN=smtp://user:pass@smtp.example.com:port

.. configuration-block::

.. code-block:: yaml

# config/packages/mailer.yaml
framework:
mailer:
dsn: '%env(MAILER_DSN)%'

.. code-block:: xml

<!-- config/packages/mailer.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:framework="http://symfony.com/schema/dic/symfony"
xsi:schemaLocation="http://symfony.com/schema/dic/services
https://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
<framework:config>
<framework:mailer dsn="%env(MAILER_DSN)%"/>
</framework:config>
</container>

.. code-block:: php

// config/packages/mailer.php
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->extension('framework', [
'mailer' => [
'dsn' => '%env(MAILER_DSN)%',
]
]);
};

.. caution::

If you are migrating from Swiftmailer (and the Swiftmailer bundle), be
warned that the DSN format is different.

Using built-in transports
~~~~~~~~~~~~~~~~~~~~~~~~~

============ ==================================== ===========
DSN protocol Example Description
============ ==================================== ===========
smtp smtp://user:pass@smtp.example.com:25 Mailer uses an SMTP server to send emails
sendmail sendmail://default Mailer uses the local sendmail binary to send emails
============ ==================================== ===========


Using a 3rd Party Transport
~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand DownExpand Up@@ -822,6 +869,8 @@ and it will select the appropriate certificate depending on the ``To`` option::
$firstEncryptedEmail = $encrypter->encrypt($firstEmail);
$secondEncryptedEmail = $encrypter->encrypt($secondEmail);

.. _multiple-email-transports:

Multiple Email Transports
-------------------------

Expand Down
116 changes: 113 additions & 3 deletionsreference/configuration/framework.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -98,7 +98,7 @@ Configuration
* `cafile`_
* `capath`_
* `ciphers`_
* `headers`_
*:ref:`headers <http-headers>`
* `http_version`_
* `local_cert`_
* `local_pk`_
Expand DownExpand Up@@ -126,7 +126,7 @@ Configuration
* `cafile`_
* `capath`_
* `ciphers`_
* `headers`_
*:ref:`headers <http-headers>`
* `http_version`_
* `local_cert`_
* `local_pk`_
Expand All@@ -151,6 +151,17 @@ Configuration

* :ref:`name <reference-lock-resources-name>`

* `mailer`_

* :ref:`dsn <mailer-dsn>`
* `transports`_
* `envelope`_

* `sender`_
* `recipients`_

* :ref:`headers <mailer-headers>`

* `php_errors`_

* `log`_
Expand All@@ -159,7 +170,7 @@ Configuration
* `profiler`_

* `collect`_
* `dsn`_
*:ref:`dsn <profiler-dsn>`
* :ref:`enabled <reference-profiler-enabled>`
* `only_exceptions`_
* `only_master_requests`_
Expand DownExpand Up@@ -867,6 +878,8 @@ ciphers
A list of the names of the ciphers allowed for the SSL/TLS connections. They
can be separated by colons, commas or spaces (e.g. ``'RC4-SHA:TLS13-AES-128-GCM-SHA256'``).

.. _http-headers:

headers
.......

Expand DownExpand Up@@ -1075,6 +1088,8 @@ only_master_requests
When this is set to ``true``, the profiler will only be enabled on the master
requests (and not on the subrequests).

.. _profiler-dsn:

dsn
...

Expand DownExpand Up@@ -2888,6 +2903,101 @@ Name of the lock you want to create.
decorates: lock.invoice.store
arguments: ['@lock.invoice.retry_till_save.store.inner', 100, 50]

mailer
~~~~~~

.. _mailer-dsn:

dsn
...

**type**: ``string``

The DSN used by the mailer. When several DSN may be used, use `transports` (see below) instead.

transports
..........

**type**: ``array``

A :ref:`list of DSN <multiple-email-transports>` that can be used by the mailer. A transport name is the key and the dsn is the value.

envelope
........

sender
""""""

**type**: ``string``

Sender used by the ``Mailer``. Keep in mind that this setting override a sender set in the code.

recipients
""""""""""

**type**: ``array``

Recipients used by the ``Mailer``. Keep in mind that this setting override recipients set in the code.

.. configuration-block::

.. code-block:: yaml

# config/packages/mailer.yaml
framework:
mailer:
dsn: 'smtp://localhost:25'
envelope:
recipients: ['admin@symfony.com', 'lead@symfony.com']

.. code-block:: xml

<!-- config/packages/mailer.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:framework="http://symfony.com/schema/dic/symfony"
xsi:schemaLocation="http://symfony.com/schema/dic/services
https://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
<framework:config>
<framework:mailer dsn="smtp://localhost:25">
<framework:envelope>
<framework:recipients>admin@symfony.com</framework:recipients>
<framework:recipients>lead@symfony.com</framework:recipients>
</framework:envelope>
</framework:mailer>
</framework:config>
</container>

.. code-block:: php

// config/packages/mailer.php
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->extension('framework', [
'mailer' => [
'dsn' => 'smtp://localhost:25',
'envelope' => [
'recipients' => [
'admin@symfony.com',
'lead@symfony.com',
]
]
]
]);
};

.. _mailer-headers:

headers
.......

**type**: ``array``

Headers to add to emails. key (``name`` attribute in xml format)
is the header name and value the header value.

workflows
~~~~~~~~~

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp