On Azure Portal
- Add App
- Enable API Permission, Scopes
https://outlook.office.com/IMAP.AccessAsUser.All
https://outlook.office.com/SMTP.Send
- openid
- offline_access
- profile
- Enable SMTP for User Give mailbox permissions to another user - Admin Help - Microsoft 365 admin | Microsoft Learn
Connected App
- Add list of scopes
- redirect uri on both ends should match
- use openid configuration endpoint and or manually save endpoints for authorize and token
Email Account
- Use same user account as email account or check
Always use this email address as sender