Forum > Third party

Send mail with Microsoft Graph API (using Daraja HTTP Framework)

(1/1)

mjustin:
Send mails via the Graph API: a new example project for the Daraja HTTP Framework demonstrates how to get an access token using the implicit grant flow, and how to invoke the Graph API to send an email. No additional configuration is required, as the project uses an existing Microsoft Entra App registratio´╗┐n, which is limited to the permissions for reading the user profile and sending emails.

You may configure your own App registration and use its Application (client) ID in the source code of unit MainUnit, or contact me to provide a modified App registration.

Requirements:
- Daraja HTTP Framework source and source/optional units.
- Indy 10.6.2 (https://github.com/IndySockets)
- OpenSSL DLLs for Indy (https://github.com/IndySockets/OpenSSL-Binaries)
- Delphi 2009+ or Lazarus / FPC 3.2

Example source code:
- https://github.com/michaelJustin/daraja-framework/tree/master/demo/tutorial12

Daraja HTTP Framework download:
- https://github.com/michaelJustin/daraja-framework

Feature overview:
- https://www.habarisoft.com/daraja_framework.html

Getting Started PDF:
- https://www.habarisoft.com/daraja_framework/2.7.1/docs/DarajaFrameworkGettingStarted.pdf

mjustin:
Update / new blog post:

Microsoft identity platform and OAuth 2.0 authorization code flow example for Daraja HTTP Framework

The Authorization Code Flow with Proof Key for Code Exchange (PKCE) is a recommended OAuth 2.0 flow for native apps. No client secret is required in this flow. Instead, a secret is created by the calling application that can be verified by the authorization server.

The example application requests an authorization code, redeems the code for an access token, and then calls the Microsoft Graph API to retrieve user profile data, and to send an email on behalf of the signed-in user.

Software requirements
* Daraja HTTP Framework (https://github.com/michaelJustin/daraja-framework). The example code is located in the entra_auth_code_flow folder of the master branch.
* Indy (https://github.com/IndySockets) with OpenSSL DLLs for Indy (https://github.com/IndySockets/OpenSSL-Binaries)
* JsonDataObjects (https://github.com/ahausladen/JsonDataObjects)

Daraja HTTP Framework download:
- https://github.com/michaelJustin/daraja-framework




Navigation

[0] Message Index

Go to full version