Skip to content
This repository was archived by the owner on May 25, 2026. It is now read-only.

Latest commit

 

History

29 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

GitHub issues GitHub forks GitHub top language GitHub stars

Secure Delphi SMTP With OAuth2

Requirements for FPCUnit test project

  • Lazarus IDE
  • Add required package for FPCUnit to the project
  • 64 Bit OpenSSL DLLs from Indy
  • Indy Sockets

Configuration

  • Add tenant id, client id and client secret in unit oauth2tokenprovider

const
TokenEndpoint = 'https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token';
ClientID = '{client-id}';
ClientSecret = '{client-secret}';

  • Set recipient address and name in unit smtpoauth2client

AddressItem := IdMessage.Recipients.Add;
AddressItem.Address := 'recipient@example.com';
AddressItem.Name := 'Recipient';

  • Set authorized user and password (the auth token) in smtpoauth2client

UserPass := TIdUserPassProvider.Create(IdSMTP);
UserPass.Username := 'user@example.com';
UserPass.Password := OAuth2Token;

About

Sending emails through Exchange Online using SMTP with OAuth2 can be a robust, secure alternative to traditional username/password authentication.

Topics

Resources

Stars

7 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages