@@ -290,24 +290,31 @@ Overriding default SMTP authenticators
290
290
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
291
291
292
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::
293
+ available on the SMTP server, one after the other. In some cases, it may be
294
+ useful to redefine the supported authentication methods to ensure that the
295
+ preferred method will be used first.
296
+
297
+ This can be done from ``EsmtpTransport `` constructor or using the
298
+ ``setAuthenticators() `` method::
297
299
298
300
use Symfony\Component\Mailer\Transport\Smtp\Auth\XOAuth2Authenticator;
299
301
use Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport;
300
302
303
+ // Choose one of these two options:
304
+
305
+ // Option 1: pass the authenticators to the constructor
301
306
$transport = new EsmtpTransport(
302
307
host: 'oauth-smtp.domain.tld',
303
308
authenticators: [new XOAuth2Authenticator()]
304
309
);
310
+
311
+ // Option 2: call a method to redefine the authenticators
305
312
$transport->setAuthenticators([new XOAuth2Authenticator()]);
306
313
307
- .. versionadded:: 6.3
314
+ .. versionadded :: 6.3
308
315
309
- The ``$authenticators`` constructor parameter and the ``setAuthenticators()`` method
310
- were introduced in Symfony 6.3.
316
+ The ``$authenticators `` constructor parameter and the ``setAuthenticators() ``
317
+ method were introduced in Symfony 6.3.
311
318
312
319
Other Options
313
320
~~~~~~~~~~~~~
0 commit comments