Skip to content

[Mailer] Document EsmtpTransport::setAuthenticators() #18212

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 1 commit into from
May 5, 2023
Merged
Changes from all 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
23 changes: 23 additions & 0 deletions mailer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,29 @@ the application or when using a self-signed certificate::

$dsn = 'smtp://user:pass@smtp.example.com?verify_peer=0';

Overriding default SMTP authenticators
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

By default, SMTP transports will try to login using all authentication methods
available on the SMTP server, one after the other. In some cases, it may be useful
to redefine the supported authentication methods to ensure that the preferred method
will be used first.
This can be done from ``EsmtpTransport`` constructor or using the ``setAuthenticators()`` method::

use Symfony\Component\Mailer\Transport\Smtp\Auth\XOAuth2Authenticator;
use Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport;

$transport = new EsmtpTransport(
host: 'oauth-smtp.domain.tld',
authenticators: [new XOAuth2Authenticator()]
);
$transport->setAuthenticators([new XOAuth2Authenticator()]);

.. versionadded:: 6.3

The ``$authenticators`` constructor parameter and the ``setAuthenticators()`` method
were introduced in Symfony 6.3.

Other Options
~~~~~~~~~~~~~

Expand Down