Skip to content

Describe configuration behaviour with multiple mailers #5724

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

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
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
6 changes: 6 additions & 0 deletions reference/configuration/swiftmailer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -303,3 +303,9 @@ Each mailer is registered as a service::

// returns the second mailer
$container->get('swiftmailer.mailer.second_mailer');

.. caution::

The configuration in the ``swiftmailer`` key (see above) is a shortcut
syntax for the default mailer. If you use multiple mailers, you need to
set options like ``disable_delivery`` separately for the additional mailers.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would reword this a bit:

.. caution::

    When configuring multiple mailers, options must be placed under the appropriate
    mailer key of the configuration. Options placed directly under the `swiftmailer`
    key will not be applied to all mailers, but will configure a mailer named
    ``default`` instead.

What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, Christian, I think your wording sounds great and explains the issue well.
If i interpret the configuration code correctly, the default mailer doesn't have to be named default, but it has to be configured as default_mailer.

Edit: Oh, seems like it simply uses the name default regardless of the configured default_mailer - This surprised me again 😄

I'll push a new commit to my PR which contains your rewording.