Skip to content

Fork of NatchEurope/FluentEmail.Graph that modifies the GraphSender to use an upload session for sending emails with attachments that are 3MB or larger

License

Notifications You must be signed in to change notification settings

huntmj01/FluentEmail.Graph

 
 

Repository files navigation

FluentEmail.Graph

Sender for FluentEmail that uses Microsoft Graph API.

Nuget

CI CodeQL Publish

Usage

Call one of the AddGraphSender extension methods.

var graphSenderOptions = this.Configuration
    .GetSection("GraphSenderOptions")
    .Get<GraphSenderOptions>();
services.AddFluentEmail("[email protected]")
    .AddRazorRenderer()
    .AddGraphSender(graphSenderOptions);

Example config in appsettings.json

{
  "GraphSenderOptions": {
    "TenantId": "your tenant id",
    "ClientId": "your app id",
    "Secret": "your secret here"
  }
}

v2

The original version only used the user: sendMail Graph API endpoint. This could not handle attachments over 3MB.

Starting with v2, if you have included any attachments, the implementation will switch to the following:

⚠️BREAKING: The Mail.ReadWrite permission is required when adding attachments.

Microsoft Docs on using the Graph API to send large attachments

⚠️REMOVED: Unfortunately, the Microsoft Graph API Send method does not have a SaveSentItems argument like the SendMail method that was previously used. The SaveSentItems option has been removed and there is no way to disable this anymore. ( See Link 1 , Link 2, and Link 3).

Uploading attachments to a draft message was contributed by @huntmj01.

Graph API Permissions

The Mail.Send permission must be granted.

Adding attachments? Then the Mail.ReadWrite permissions is also required.

Release

Create new release with creation of new tag on main branch.

Start publish manually, for the new tag. This will push the package to github and nuget.org

Origin

Code originally written by Matt Goldman and merged into FluentEmail repo. But it was not published to NuGet until January 2021. Because we needed this implementation we created a separate repo, modified the code a bit and published it to NuGet.

About

Fork of NatchEurope/FluentEmail.Graph that modifies the GraphSender to use an upload session for sending emails with attachments that are 3MB or larger

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 100.0%