I am using this curl:
curl -vvv --url 'smtp://smtp.office365.com:587' \
--ssl-reqd \
--mail-from "$user" \
--mail-rcpt "$destuser" \
--upload-file ./mail.txt \
--oauth2-bearer $accesstoken
to try to send an email from an account where I registered an oauth application with these Graph Permission - Delegated Permissions
SMTP.Send
Mail.Read
Mail.Send
openid
offline_access
but I always get error: 530 5.7.57 Client not authenticated to send mail.
both the user mailbox and the transport have SmtpClientAuthenticationDisabled to $false
I am quite confident that the access token is valid, I also tested the refresh token which works, any idea on how to make this work?
Is curl compatible with https://docs.microsoft.com/en-us/exchange/client-developer/legacy-protocols/how-to-authenticate-an-imap-pop-smtp-application-by-using-oauth
?