Fusonic.Extensions.Email 8.0.0-preview1

Prefix Reserved
This is a prerelease version of Fusonic.Extensions.Email.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Fusonic.Extensions.Email --version 8.0.0-preview1                
NuGet\Install-Package Fusonic.Extensions.Email -Version 8.0.0-preview1                
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="Fusonic.Extensions.Email" Version="8.0.0-preview1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Fusonic.Extensions.Email --version 8.0.0-preview1                
#r "nuget: Fusonic.Extensions.Email, 8.0.0-preview1"                
#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.
// Install Fusonic.Extensions.Email as a Cake Addin
#addin nuget:?package=Fusonic.Extensions.Email&version=8.0.0-preview1&prerelease

// Install Fusonic.Extensions.Email as a Cake Tool
#tool nuget:?package=Fusonic.Extensions.Email&version=8.0.0-preview1&prerelease                

Email

Setup

The following sample binds settings from the configuration located in the section "Email" using SimpleInjector.

The settings contain sender Email and name, SMTP settings, Debug settings and CSS settings. Check the EmailSettings class for details.

container.RegisterEmail(options => Configuration.GetSection("Email").Bind(options));

Create and send an email

To add new emails, following steps need to be done:

  1. Add a new View (.cshtml) in the directory Views/Emails/.
  2. Add a new ViewModel in the same namespace as the business logic that needs to send the mail.
  3. Add the EmailView attribute to the ViewModel. The constructor argument is path to the view, relative to the Views directory without the .cshtml extension. Example: [EmailView("Emails/Registration")] points to Views/Emails/Registration.cshtml.
  4. Extend the EmailController with a new method to render the view file and return the contents.
  5. To send the mail in the business logic use the MediatR-command SendEmail and supply it with the view model. SendEmail renders the mail based on the view model and the EmailViewAttribute.

To check the visuals of the view file, use the Swagger API to access the methods of the EmailController.

View locations

The views that are used for the emails are configured on the EmailViewAttribute. To find the view, the Razor view engine looks in the folder Views by default. A view path of Emails/FancyEmail matches to Views/Emails/FancyEmail.cshtml.

If you want to place the Views in other folders, for example /Emails, you can simply configure this in the Razor options as follows:

services.Configure<RazorViewEngineOptions>(options => options.ViewLocationFormats.Add("/Emails/{0}" + RazorViewEngine.ViewExtension));

Attachments

By default, only attachments in file://-Uris are supported. To allow adding attachments from other sources (eg. AWS S3), implement IEmailAttachmentResolver and register it SimpleInjector with

container.Collections.Append<IEmailAttachmentResolver, YourResolver>()
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 was computed.  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. 
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
9.5.2 43 1/16/2025
9.5.0 201 10/4/2024
9.4.0 119 9/23/2024
9.3.1 191 9/11/2024
9.3.0 113 9/11/2024
9.2.0 147 8/8/2024
9.2.0-rc.3 59 8/7/2024
9.2.0-rc.2 43 8/5/2024
9.2.0-rc.1 54 8/1/2024
9.1.0 82 7/29/2024
9.0.0 522 7/17/2024
9.0.0-preview.2 73 6/13/2024
9.0.0-preview.1 69 4/5/2024
8.1.3 215 3/27/2024
8.1.2 124 3/27/2024
8.1.1 119 3/1/2024
8.1.0 1,178 1/26/2024
8.0.1 187 12/18/2023
8.0.1-rc.2 87 12/7/2023
8.0.1-rc.1 79 12/6/2023
8.0.0 239 11/21/2023
8.0.0-preview1 119 10/4/2023
7.4.0 117 1/25/2024
7.3.0 205 10/11/2023
7.2.1-rc.1 99 8/28/2023
7.2.0 395 6/28/2023
7.2.0-alpha.1 91 6/27/2023
7.1.2 519 5/25/2023
7.1.1 900 4/3/2023
7.1.1-rc.2 95 3/30/2023
7.1.1-rc.1 89 3/30/2023
7.1.0 832 2/28/2023
7.1.0-rc.1 102 2/20/2023
7.0.4-rc.5 103 2/23/2023
7.0.4-rc.4 100 2/23/2023
7.0.4-rc.3 99 2/23/2023
7.0.4-rc.2 98 2/22/2023
7.0.4-rc.1 110 2/16/2023
7.0.3 428 2/16/2023
7.0.2 290 2/9/2023
7.0.2-rc.1 118 2/2/2023
7.0.1 613 1/26/2023
7.0.0 490 1/24/2023
7.0.0-preview1 160 7/18/2022
7.0.0-beta.9 113 1/24/2023
7.0.0-beta.8 104 1/23/2023
7.0.0-beta.7 107 1/23/2023
7.0.0-beta.6 106 1/23/2023
7.0.0-beta.5 118 1/23/2023
7.0.0-beta.4 111 1/19/2023
7.0.0-beta.3 105 1/17/2023
7.0.0-beta.2 111 1/11/2023
7.0.0-beta.1 98 11/24/2022
6.2.2 1,287 9/20/2022
6.2.2-rc.1 123 9/19/2022
6.2.1 1,953 5/4/2022
6.2.0 491 4/21/2022
6.2.0-rc.2 138 4/21/2022
6.2.0-rc.1 136 4/20/2022
6.1.1 982 3/1/2022
6.1.0 640 2/10/2022
6.1.0-rc.3 134 2/10/2022
6.1.0-rc.2 125 2/10/2022
6.1.0-rc.1 132 2/9/2022
6.0.3 1,430 1/18/2022
6.0.2 791 1/10/2022
6.0.1 341 12/16/2021
6.0.0 664 12/13/2021
6.0.0-rc.6 157 12/6/2021
6.0.0-rc.5 352 12/6/2021
6.0.0-rc.4 491 12/6/2021
6.0.0-rc.3 369 12/6/2021
6.0.0-rc.2 349 12/6/2021
6.0.0-rc.1 645 11/15/2021
5.4.0 681 10/13/2021
5.3.0 363 9/23/2021
5.3.0-rc.1 351 9/17/2021
5.2.0 2,646 5/20/2021
5.2.0-rcjh.6 202 5/19/2021
5.2.0-rcjh.5 156 5/19/2021
5.2.0-rcjh.4 181 5/19/2021
5.2.0-rcjh.3 154 5/19/2021
5.2.0-rcjh.2 148 4/12/2021
5.2.0-rcjh.1 148 4/12/2021
5.1.3 373 5/19/2021
5.1.2 654 3/26/2021
5.1.1 994 1/13/2021
5.1.0 1,965 12/16/2020
5.0.0 699 11/17/2020
5.0.0-rc.1 265 10/15/2020
2.0.6 1,474 10/8/2020
2.0.5 1,211 8/19/2020
2.0.4 2,443 7/10/2020
2.0.3 509 7/10/2020
2.0.2 541 7/9/2020
2.0.1 537 7/9/2020
2.0.0 526 6/17/2020
1.0.0 536 6/15/2020