mjustin 31 Posted August 17 Sending emails through Exchange Online using SMTP with OAuth2 can be a robust, secure alternative to traditional username/password authentication. This project on GitHub is still "work in progress", but has successfully been tested now: https://github.com/michaelJustin/delphi-smtp-with-oauth2 The blog post https://blog.habarisoft.com/2025/08/secure-delphi-smtp-with-oauth2/ describes the three steps to send SMTP mails via Exchange Online with OAuth2 authorization and Object Pascal. Step 1: Configure Exchange Online and Register an Entra ID App Step 2: Acquire an OAuth2 Access Token Using Indy TIdHTTP and the Client Credentials Grant Flow Step 3: Send Email Using Indy TIdSMTP with OAuth2 Access Token With under 150 lines of code, the project stays lean and transparent—making it easy to adopt, extend, prototype, and test without overhead. Technical references: * Authenticate an IMAP, POP or SMTP connection using OAuth Share this post Link to post