Jump to content

Send mail with Microsoft Graph API

Recommended Posts

Posted (edited)

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 registration , 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.






Edited by mjustin
Tag added

Share this post

Link to post

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

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now