File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -286,6 +286,29 @@ the application or when using a self-signed certificate::
286286
287287 $dsn = 'smtp://user:pass@smtp.example.com?verify_peer=0';
288288
289+ Overriding default SMTP authenticators
290+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
291+
292+ By default, SMTP transports will try to login using all authentication methods
293+ available on the SMTP server, one after the other. In some cases, it may be useful
294+ to redefine the supported authentication methods to ensure that the preferred method
295+ will be used first.
296+ This can be done from ``EsmtpTransport `` constructor or using the ``setAuthenticators() `` method::
297+
298+ use Symfony\Component\Mailer\Transport\Smtp\Auth\XOAuth2Authenticator;
299+ use Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport;
300+
301+ $transport = new EsmtpTransport(
302+ host: 'oauth-smtp.domain.tld',
303+ authenticators: [new XOAuth2Authenticator()]
304+ );
305+ $transport->setAuthenticators([new XOAuth2Authenticator()]);
306+
307+ .. versionadded:: 6.3
308+
309+ The ``$authenticators`` constructor parameter and the ``setAuthenticators()`` method
310+ were introduced in Symfony 6.3.
311+
289312Other Options
290313~~~~~~~~~~~~~
291314
You can’t perform that action at this time.
0 commit comments