#Sending email using XOAUTH2

2 messages · Page 1 of 1 (latest)

velvet forge
#

When using Mail-class/facade in Laravel we easily can send messages using basic auth. Even XOAUTH2 authentication works, sometimes. It seems the SMTP-provider first tries basic auth, then XOAUTH2. Is it possible to disable the test of basic aith? It seems Outlook/Exchange denies our authentication most of the time and we have to retry sending mails multiple times before it goes through.
Any idea why? I've set tries to 30 and added a backoff timer, but would be nice to not be rejected by the mailserver so often.

It seems to be possible when using Symfony mailer (which I think Laravel uses under the hood). Then it can be configured like this:

$transport->setAuthenticators([new XOAuth2Authenticator()]);
velvet forge
#

Not sure, but sending these via a queue.. I ran into a problem previously where mailer had cached the credentials for the outgoing mail, and since a token changes all the time, maybe this is what is causing the problem?
I have a build()-method in my mailable where I set configuration using config(["mail.mailer.tenant.$id" => [/*...*/]) syntax. Could this have been cached so it never uses the new token?