Problem sending Mail via smtp-mail.outlook.com / OAUTH2 as SMTP or JSON
Hi,
I do have the problem to send mails to outlook after getting the new OAUTH2 token.
I have no problem getting the token, but after I got the token I try to send the mail thru smtp but authorization failed , please see my try to send the token thru the %Net.Authenticator mechanism %Net.SASL.XOAUTH2
Is this ok?
Or is there an other method to authenticate using the needed bearer method instead of user/pwd with the authenticator?
....code to get the token is working..
... set s=##class(%Net.SMTP).%New()
set m=##class(%Net.MailMessage).%New()
set auth=##class(%Net.Authenticator).%New()
set auth.UserName="user@..."
set meth=##class(%Net.SASL.XOAUTH2).%New()
set meth.MechanismName="XOAUTH2"
set meth.AccessToken=".....the token i got from Microsoft....sadfsafasdfasdfasdfasdfsdfs...."
set auth.Mechanism=meth
set auth.ServiceName="smtp"
set s.authenticator=auth
set s.port=587
set s.SSLConfiguration="ISC.FeatureTracker.SSL.Config"
set s.UseSTARTTLS=1
set m.Subject=SUBJECT
set m.Charset="iso-8859-1"
set m.IsHTML=1
...etc all other smtp properties....