FlexiMail 0.1.6
dotnet add package FlexiMail --version 0.1.6
NuGet\Install-Package FlexiMail -Version 0.1.6
<PackageReference Include="FlexiMail" Version="0.1.6" />
<PackageVersion Include="FlexiMail" Version="0.1.6" />
<PackageReference Include="FlexiMail" />
paket add FlexiMail --version 0.1.6
#r "nuget: FlexiMail, 0.1.6"
#:package FlexiMail@0.1.6
#addin nuget:?package=FlexiMail&version=0.1.6
#tool nuget:?package=FlexiMail&version=0.1.6
<p align="center"> <img src="https://github.com/mabroukmahdhi/FlexiMail/blob/main/FlexiMail/icmail.png" alt="FlexiMail logo"> </p>
FlexiMail
FlexiMail is a test-driven email client for .NET 8 and C# 12 that now supports both Exchange (EWS) and Microsoft Graph through the new FlexiGraphService.
Features
- Exchange and Microsoft Graph mail sending with sent-items copy
FlexiGraphServicefor Graph-based delivery- Asynchronous APIs
- Test-first design with unit and integration coverage
Installation
dotnet add package FlexiMail
# or
Install-Package FlexiMail
Usage
Note: The Exchange constructor of
FlexiMailClientis compiled only fornet8.0andnet9.0. When targetingnet10.0, use the Graph constructor (FlexiMailClient(GraphMailConfigurations)).
Send via Exchange (EWS)
using FlexiMail;
using FlexiMail.Models.Configurations;
using FlexiMail.Models.Foundations.Bodies;
using FlexiMail.Models.Foundations.Messages;
var configurations = new ExchangeConfigurations
{
ClientId = "your-client-id",
ClientSecret = "your-client-secret",
TenantId = "your-tenant-id",
Authority = "https://login.microsoftonline.com/{tenantId}",
Scopes = ["https://outlook.office365.com/.default"],
SmtpAddress = "sender@domain.com"
};
var client = new FlexiMailClient(configurations);
await client.SendAndSaveCopyAsync(new FlexiMessage
{
To = ["email@domain.com"],
Subject = "Hello from FlexiMail",
Body = new FlexiBody
{
Content = "This is the message body.",
ContentType = BodyContentType.PlainText
}
});
Send via Microsoft Graph
using FlexiMail;
using FlexiMail.Models.Configurations;
using FlexiMail.Models.Foundations.Bodies;
using FlexiMail.Models.Foundations.Messages;
var configurations = new GraphMailConfigurations
{
ClientId = "your-client-id",
ClientSecret = "your-client-secret",
TenantId = "your-tenant-id",
SenderUserIdOrUpn = "sender@domain.com",
Scopes = ["https://graph.microsoft.com/.default"]
};
var client = new FlexiMailClient(configurations);
await client.SendAndSaveCopyAsync(new FlexiMessage
{
To = ["email@domain.com"],
Subject = "Hello from FlexiGraphService",
Body = new FlexiBody
{
Content = "Graph-powered delivery.",
ContentType = BodyContentType.Html
}
});
Configuration
Example appsettings.json snippet:
{
"ExchangeConfigurations": {
"ClientId": "your-client-id",
"ClientSecret": "your-client-secret",
"TenantId": "your-tenant-id",
"SmtpAddress": "sender@domain.com",
"Authority": "https://login.microsoftonline.com/{tenantId}",
"Scopes": ["https://outlook.office365.com/.default"]
},
"GraphMailConfigurations": {
"ClientId": "your-client-id",
"ClientSecret": "your-client-secret",
"TenantId": "your-tenant-id",
"SenderUserIdOrUpn": "sender@domain.com",
"Scopes": ["https://graph.microsoft.com/.default"]
}
}
Architecture
- Brokers: integrations with Exchange and Graph
- Services: core workflows, including
FlexiGraphServicefor Graph - Models: message, body, and configuration contracts
FlexiMailClient chooses the appropriate service based on the provided configuration and always saves a copy to Sent Items.
Contributing
- Fork the repository
- Create a branch (
git checkout -b users/your-github-id/feature-name) - Commit (
git commit -m "Add feature") - Push (
git push origin users/your-github-id/feature-name) - Open a Pull Request
License
MIT. See LICENSE.
Contact
For questions: contact@mahdhi.com
| Product | Versions 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 is compatible. 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. |
-
net10.0
- Azure.Identity (>= 1.17.1)
- Microsoft.Extensions.DependencyInjection (>= 10.0.2)
- Microsoft.Graph (>= 5.101.0)
- Xeption (>= 2.8.0)
-
net8.0
- Azure.Identity (>= 1.17.1)
- Microsoft.Exchange.WebServices (>= 2.2.0)
- Microsoft.Extensions.DependencyInjection (>= 10.0.2)
- Microsoft.Graph (>= 5.101.0)
- Xeption (>= 2.8.0)
-
net9.0
- Azure.Identity (>= 1.17.1)
- Microsoft.Exchange.WebServices (>= 2.2.0)
- Microsoft.Extensions.DependencyInjection (>= 10.0.2)
- Microsoft.Graph (>= 5.101.0)
- Xeption (>= 2.8.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Ignore EWS for .NET 10