try{ $transport->send($message); $this->fail('Symfony\Component\Mailer\Exception\TransportException to be thrown'); }catch(TransportException $e){ $this->assertStringStartsWith('Failed to authenticate on SMTP server with username "testuser" using the following authenticators: "XOAUTH2".', $e->getMessage()); }
if(null === $authenticators){ // fallback to default authenticators
// order is important here (roughly most secure and popular first)
$authenticators = [ new Auth\CramMd5Authenticator(), new Auth\LoginAuthenticator(), new Auth\PlainAuthenticator(), new Auth\XOAuth2Authenticator(), ]; } $this->setAuthenticators($authenticators);