I'm working on an email trigger component where I have been able to successfully use client_credentials flow with Microsoft graph API.
However I want to be able to use spring email and bring in benefits it provides over a rest api call to the Microsoft graph API, things like using thymeleaf email templates for decorating the emails.
I tried doing that by first getting the token from Microsoft graph and use it as the password for the JavaMailSender instance and by using host as smtp.office365.com but it didn't work. I followed this link for that experiment JavaMail connecting to Office 365 XOAUTH2 for IMAP Authentication fails
Is there an easy way to do this? I want to basically get the best of both worlds, spring email and Microsoft graph API