Edi.TemplateEmail 2025.4.0

dotnet add package Edi.TemplateEmail --version 2025.4.0
                    
NuGet\Install-Package Edi.TemplateEmail -Version 2025.4.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="Edi.TemplateEmail" Version="2025.4.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Edi.TemplateEmail" Version="2025.4.0" />
                    
Directory.Packages.props
<PackageReference Include="Edi.TemplateEmail" />
                    
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 Edi.TemplateEmail --version 2025.4.0
                    
#r "nuget: Edi.TemplateEmail, 2025.4.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 Edi.TemplateEmail@2025.4.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=Edi.TemplateEmail&version=2025.4.0
                    
Install as a Cake Addin
#tool nuget:?package=Edi.TemplateEmail&version=2025.4.0
                    
Install as a Cake Tool

Edi.TemplateEmail

This library enable you to configure email in XML template and send the email in your .NET applications.

Currently, only SMTP Basic Authentication is supported.

NuGet

Install

dotnet add package Edi.TemplateEmail

Usage

Step 1: Put a mailConfiguration.xml somewhere you like

<?xml version="1.0"?>
<MailConfiguration>
  <CommonConfiguration OverrideToAddress="false" ToAddress="overridetest@test.com" />
  <MailMessage MessageType="TestMail" IsHtml="true">
    <MessageSubject>Test Mail on {MachineName.Value}</MessageSubject>
    <MessageBody>
      <![CDATA[
Mail configuration on {MachineName.Value} is good: <br />
Smtp Server: {SmtpServer.Value}<br />
Smtp Port: {SmtpServerPort.Value}<br />
Smtp Username: {SmtpUserName.Value}<br />
Email Display Name: {EmailDisplayName.Value}<br />
Enable SSL: {EnableSsl.Value}<br />
      ]]>
    </MessageBody>
  </MailMessage>
</MailConfiguration>

Step 2:

Initialize the EmailHelper by your mail server settings

// Change these values
var smtpServer = "smtp.example.com";
var userName = "test1@example.com";
var password = "********";
var port = 25;
var toAddress = "test2@test.com";

var configSource = $"{Directory.GetCurrentDirectory()}\\mailConfiguration.xml";
var emailHelper = new EmailHelper(configSource, new(smtpServer, userName, password, port)
{
    SenderName = senderName,
    EmailDisplayName = displayName
});

Step 3: Map the values and send Email

var message = emailHelper.ForType("TestMail")
    .Map("MachineName", Environment.MachineName)
    .Map("SmtpServer", emailHelper.Settings.SmtpServer)
    .Map("SmtpServerPort", emailHelper.Settings.SmtpServerPort)
    .Map("SmtpUserName", emailHelper.Settings.SmtpUserName)
    .Map("EmailDisplayName", emailHelper.Settings.EmailDisplayName)
    .Map("EnableTls", emailHelper.Settings.EnableTls)
    .BuildMessage([toAddress]);

var result = await message.SendAsync();
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
2025.4.0 196 7/2/2025
2025.3.0 170 6/6/2025
2025.2.0 247 2/25/2025
2025.1.0 126 1/6/2025
2024.6.0 154 11/13/2024
2024.5.0 160 10/11/2024
2024.4.0 123 10/10/2024
2024.3.0 128 10/10/2024
2024.2.1 127 10/8/2024
2024.2.0 183 8/7/2024
2024.1.0 398 5/18/2024
2023.4.3 162 4/15/2024
2023.4.2 612 3/4/2024
2023.4.1 2,945 11/13/2023
2023.4.0 990 10/11/2023
2023.3.0 203 9/5/2023
2023.2.2 249 6/19/2023
2023.2.1 216 6/11/2023
2023.2.0 259 4/29/2023
2023.1.1 309 3/15/2023
2023.1.0 357 2/17/2023
2022.5.1 420 12/2/2022
2022.5.0 412 11/9/2022
2022.4.4 463 10/27/2022
2022.4.3 878 9/13/2022
2022.4.2 621 9/7/2022
2022.4.1 531 8/6/2022
2022.4.0 529 6/20/2022
2022.3.0 595 4/15/2022
2022.2.1 561 4/15/2022
2022.2.0 546 4/15/2022
2022.1.0 566 2/9/2022
2021.2.0 539 10/21/2021
2021.1.2 2,259 5/18/2021
2021.1.1 483 4/22/2021
2021.1.0 548 1/27/2021
2020.3.1 608 11/27/2020
2020.3.0 589 11/11/2020
2020.2.4 617 9/15/2020
2020.2.3 676 7/15/2020
2020.2.2 701 6/22/2020
2020.2.1 673 6/10/2020
2020.2.0 641 4/26/2020
2020.1.1 752 3/25/2020
2020.1.0 684 2/20/2020
2019.2.2 732 12/4/2019
2019.2.1 694 10/2/2019