You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Symfony->Mailer additional Method: EsmtpTransport->setAuthenticators (because of Microsoft Authentification with OAuth for SMTP sending is slow) #49701
I work with the Symfony/Mailer 5.4.7 and can send E-Mails with Microsoft Outlook and XOAuth2.
But the Problem is, its very slow.
This happens because Microsoft provides the possibility for
LoginAuthenticator and XOAUTH2Authenticator in the protocoll. And in the symfony/mailer/Transport/Smtp/EsmtpTransport.php:38 constructor are the authenticators set to use both. What understandable is when you want to support most used Authenticators.
public function __construct(string $host = 'localhost', int $port = 0, bool $tls = null, EventDispatcherInterface $dispatcher = null, LoggerInterface $logger = null)
{
parent::__construct(null, $dispatcher, $logger);
// order is important here (roughly most secure and popular first)
$this->authenticators = [
new Auth\CramMd5Authenticator(),
new Auth\LoginAuthenticator(),
new Auth\PlainAuthenticator(),
new Auth\XOAuth2Authenticator(),
];
But through this order, it trys always at first the LoginAuthenticator and waits for a timeout, and after
that it uses the XOAUTH2Authenticator.
I copied the EsmtpTransport class and only changed the $this->authenticators, to hold only the XOAuth2Authenticator.
There is a difference in time for sending Mails between 22s with both Authenticators, and 5s with my own EsmtpTransport class (where I set the authenticators to use only XOAuth2Authenticator).
Because I dont get automatic securityfixes/bugfixes with my own EsmtpTransport class. I want to ask if we can create a possibility to set the $this->authenticators?
What I see there is only a possibility to add additional authenticators.