Edi.TemplateEmail 2025.2.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Edi.TemplateEmail --version 2025.2.0
                    
NuGet\Install-Package Edi.TemplateEmail -Version 2025.2.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.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Edi.TemplateEmail" Version="2025.2.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.2.0
                    
#r "nuget: Edi.TemplateEmail, 2025.2.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.2.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.2.0
                    
Install as a Cake Addin
#tool nuget:?package=Edi.TemplateEmail&version=2025.2.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.

.NET

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();

免责申明

此项目(Edi.TemplateEmail)及其配套组件均为免费开源的产品,仅用于学习交流,并且不直接向中国提供服务,中国访客请于下载后立即删除。

任何中国境内的组织及个人不得使用此项目(Edi.TemplateEmail)及其配套组件构建任何形式的面向中国境内访客的网站或服务。

不可用于任何违反中华人民共和国(含台湾省)或使用者所在地区法律法规的用途。

因为作者即本人仅完成代码的开发和开源活动(开源即任何人都可以下载使用),从未参与访客的任何运营和盈利活动。

且不知晓访客后续将程序源代码用于何种用途,故访客使用过程中所带来的任何法律责任即由访客自己承担。

《开源软件有漏洞,作者需要负责吗?是的!》

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 (1)

Showing the top 1 NuGet packages that depend on Edi.TemplateEmail:

Package Downloads
Edi.TemplateEmail.Smtp

SMTP email sending extension for Edi.TemplateEmail using MailKit

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2026.4.2 129 5/30/2026
2026.4.1 134 4/18/2026
2026.4.0 182 3/28/2026
2026.3.0 149 3/18/2026
2026.2.0 127 3/11/2026
2026.1.0 122 2/28/2026
2025.5.0 414 11/13/2025
2025.4.0 280 7/2/2025
2025.3.0 268 6/6/2025
2025.2.0 351 2/25/2025
2025.1.0 205 1/6/2025
2024.6.0 225 11/13/2024
2024.5.0 235 10/11/2024
2024.4.0 196 10/10/2024
2024.3.0 211 10/10/2024
2024.2.1 194 10/8/2024
2024.2.0 266 8/7/2024
2024.1.0 455 5/18/2024
2023.4.3 233 4/15/2024
2023.4.2 692 3/4/2024
Loading failed