PosInformatique.Foundations.Emailing.Graph 1.0.0

Prefix Reserved
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package PosInformatique.Foundations.Emailing.Graph --version 1.0.0
                    
NuGet\Install-Package PosInformatique.Foundations.Emailing.Graph -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PosInformatique.Foundations.Emailing.Graph" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PosInformatique.Foundations.Emailing.Graph" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="PosInformatique.Foundations.Emailing.Graph" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add PosInformatique.Foundations.Emailing.Graph --version 1.0.0
                    
#r "nuget: PosInformatique.Foundations.Emailing.Graph, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package PosInformatique.Foundations.Emailing.Graph@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=PosInformatique.Foundations.Emailing.Graph&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=PosInformatique.Foundations.Emailing.Graph&version=1.0.0
                    
Install as a Cake Tool

PosInformatique.Foundations.Emailing.Graph

NuGet version NuGet downloads

Introduction

PosInformatique.Foundations.Emailing.Graph provides an IEmailProvider implementation for PosInformatique.Foundations.Emailing based on the Microsoft Graph API.

It uses Microsoft.Graph.GraphServiceClient to send templated emails (created via IEmailManager) through a Microsoft 365 mailbox, using Azure AD authentication.

Authentication is fully driven by an Azure.Core.TokenCredential instance, allowing you to use:

  • Managed identity
  • Client credentials (client id/secret or certificate)
  • Interactive login, device code, etc.

Install

You can install the package from NuGet:

dotnet add package PosInformatique.Foundations.Emailing.Graph

Features

  • IEmailProvider implementation using Microsoft.Graph.GraphServiceClient.
  • Simple configuration through AddEmailing().UseGraph(...).
  • Authentication configured via TokenCredential:
    • DefaultAzureCredential (managed identity, VS, CLI, etc.)
    • ClientSecretCredential, ClientCertificateCredential, etc.
  • Optional baseUrl parameter to customize the Graph endpoint (defaults to https://graph.microsoft.com/v1.0).
  • Sends HTML emails using the EmailMessage produced by PosInformatique.Foundations.Emailing.

Basic configuration

Using DefaultAzureCredential (managed identity or local dev)

using Azure.Identity;
using Microsoft.Extensions.DependencyInjection;
using PosInformatique.Foundations.EmailAddresses;
using PosInformatique.Foundations.Emailing;
using PosInformatique.Foundations.Emailing.Graph;

var services = new ServiceCollection();

// TokenCredential for Microsoft Graph (for example: managed identity or local dev)
var credential = new DefaultAzureCredential();

services
    .AddEmailing(options =>
    {
        options.SenderEmailAddress = EmailAddress.Parse("sender@yourtenant.onmicrosoft.com");

        // Register your templates here...
        // options.RegisterTemplate(EmailTemplateIdentifiers.Invitation, invitationTemplate);
    })
    .UseGraph(credential);

Using client credentials (app registration)

If you want to authenticate with a client id / tenant id / client secret:

using Azure.Identity;
using PosInformatique.Foundations.Emailing.Graph;

var tenantId = configuration["AzureAd:TenantId"];
var clientId = configuration["AzureAd:ClientId"];
var clientSecret = configuration["AzureAd:ClientSecret"];

var credential = new ClientSecretCredential(tenantId, clientId, clientSecret);

services
    .AddEmailing(options =>
    {
        options.SenderEmailAddress = EmailAddress.Parse("sender@yourtenant.onmicrosoft.com");
    })
    .UseGraph(credential);

The TokenCredential you provide is responsible for acquiring tokens for the Microsoft Graph API. The provider does not manage scopes or credentials itself; this is entirely delegated to the credential implementation.

Custom Graph endpoint

You can optionally customize the Graph base URL (for example, for national clouds):

var baseUrl = "https://graph.microsoft.com/v1.0/beta";

services
    .AddEmailing(options =>
    {
        options.SenderEmailAddress = EmailAddress.Parse("sender@yourtenant.onmicrosoft.com");
    })
    .UseGraph(credential, baseUrl);

If baseUrl is null, https://graph.microsoft.com/v1.0 is used by default.

Typical end-to-end usage

  1. Configure emailing (sender address, templates) with AddEmailing(...).
  2. Configure the Graph provider with UseGraph(TokenCredential, baseUrl?).
  3. Inject IEmailManager and create emails from template identifiers.
  4. Add recipients and models.
  5. Call SendAsync(...) to send emails via Microsoft Graph.
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0-rc.2 60 1/26/2026
1.1.0-rc.1 60 1/23/2026
1.0.0 431 11/19/2025
1.0.0-rc.4 385 11/19/2025
1.0.0-rc.3 377 11/18/2025
1.0.0-rc.2 374 11/18/2025
1.0.0-rc.1 375 11/18/2025

1.0.0
 - Initial release with Microsoft Graph Emailing provider.