How email using OAuth and Exchange Online

Philip Tulett philip.tulett at
Tue Jul 12 08:36:03 UTC 2022

Hi Michael,

I have multiple apps that are connecting to Exchange / O365 to send and retrieving messages using ow3 objects.

>From what you have said, you are just sending emails, at this time MS are continuing to support Basic Auth for SMTP Sending:-
That said, if you are going to refactor the code to use the new worker object, it would be worth going to OAUTH at the same time.

Generally, MS tokens have a life of about an hour, so expect to receive an updated token at that rate, that will need to be saved for next connection, so capture the call to $tokensrefreshed and then save the OAUTH buffer using Do iOAUTH2.$save(iSavedOAUTHBuffer,iKey) Returns lOK
I encrypt the OAUTH buffer with a key, then save it to a binary field in the database so can be used at the next call or if the apps stops and restarts.
So, when starting a connection, I load the latest OAUTH buffer from the database.
To reduce user interaction/reauthorisation, when setting up the in AZURE, include the following tin the Scope API:- 
I my case I also include
The above will need to be include in your initial Authorization request 
If you have multiple servers that could perform the token refresh, make sure that you include them in all the Redirect URI's in AZURE.
If you will be using the Omnis Runtime's I recommend setting a unique static port for each of them (see above on Redirect URI's) in their server options "RESTful connections"

Kind regards
Philip Tulett

-----Original Message-----
From: omnisdev-en <omnisdev-en-bounces at> On Behalf Of Michael Houlberg
Sent: 11 July 2022 19:07
To: OmnisDev List - English <omnisdev-en at>
Subject: Re: How email using OAuth and Exchange Online


Thanks, I’m sure I’ll be talking with you in the future.  I see that right now I should probably make the move from SMTPSend to oSMTPWorker as a first step, since I already know how to do that.

Michael Houlberg
Houlberg Development, LLC

> On Jul 11, 2022, at 11:04 AM, Mike Matthews - Omnis via omnisdev-en <omnisdev-en at> wrote:
> I’m in the middle of using oAuth2 for Exchange / O365 / Azure.
> Most done, just need to tidy up.
> Mike Matthews
> Lineal Software Solutions
> Commercial House, The Strand<x-apple-data-detectors://1/1> Barnstaple, 
> Devon, EX31 1EU<x-apple-data-detectors://1/1>
> omnis at<mailto:mike.matthews at>
> On 11 Jul 2022, at 18:55, Michael Houlberg <michael at<mailto:michael at>> wrote:
> $Listers:
> My client who is part of a University, tells me that this fall they are dropping support for the type of email we have been using in favor of Exchange Online and using OAuth to authenticate.  Currently we send lots of emails using SMTPSend.  For another client I have had experience using the oSMTPWorker object.  But I haven’t had to deal with either oAuth or Exchange Online Server.
> Does anyone have some pointers on this they can share?
> Thanks,
> Michael Houlberg
> Houlberg Development, LLC
> _____________________________________________________________
> Manage your list subscriptions at 
> m&c=E,1,VF9Rn-JHUso614RklDy6ab1e38c_b_Z94_OemBOgjTfQUsWcqLrhXVC5OPx1Jj
> vQeQxk7_FQ1m6o4ThS5_KBhUfHFAjz1rm7xGQxq148o4eXWT3dGAcOwRlM&typo=1
> Start a new message -> mailto:omnisdev-en at
> _____________________________________________________________
> Manage your list subscriptions at Start a 
> new message -> mailto:omnisdev-en at

Manage your list subscriptions at Start a new message -> mailto:omnisdev-en at 

More information about the omnisdev-en mailing list