Soenneker.Extensions.Dtos.Email 3.0.11

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

// Install Soenneker.Extensions.Dtos.Email as a Cake Tool
#tool nuget:?package=Soenneker.Extensions.Dtos.Email&version=3.0.11                

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

alternate text is missing from this package README image Soenneker.Extensions.Dtos.Email

A collection of helpful EmailDto extension methods

๐Ÿ“ง Features

  • Converts a well-defined EmailDto into a MimeKit MimeMessage
  • Supports both html and plain formats
  • Adds To, Cc, Bcc, and Reply-To addresses
  • Automatically attaches files via EmailAttachmentDto
  • Sets headers for High and Low priority emails
  • Logs malformed recipients using ILogger

๐Ÿงช Validation

The extension validates:

  • Required fields: To, Subject, and Body
  • Non-null, non-whitespace addresses
  • Optionally logs issues rather than throwing for individual recipient fields

Installation

dotnet add package Soenneker.Extensions.Dtos.Email

๐Ÿ”ง Usage

var mimeMessage = emailDto.ToMimeMessage(logger);

๐Ÿ“ Example EmailDto

var dto = new EmailDto
{
    To = new List<string> { "to@example.com" },
    Cc = new List<string> { "cc@example.com" },
    Bcc = new List<string> { "bcc@example.com" },
    ReplyTo = "reply@example.com",
    Name = "Sender Name",
    Address = "sender@example.com",
    Subject = "Test Subject",
    Body = "<p>This is a test email.</p>",
    Format = EmailFormat.Html,
    Priority = EmailPriority.High,
    Attachments = new List<EmailAttachmentDto>
    {
        new EmailAttachmentDto
        {
            FileName = "test.txt",
            MimeType = "text/plain",
            Data = Encoding.UTF8.GetBytes("Sample attachment content")
        }
    }
};
Product Compatible and additional computed target framework versions.
.NET 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. 
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 Soenneker.Extensions.Dtos.Email:

Package Downloads
Soenneker.Email.Sender

A high-level utility responsible for orchestrating the creation and delivery of templated email messages

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.0.17 58 3/29/2025
3.0.16 44 3/29/2025
3.0.15 47 3/29/2025
3.0.14 48 3/29/2025
3.0.13 48 3/29/2025
3.0.12 41 3/29/2025
3.0.11 151 3/27/2025
3.0.10 456 3/26/2025
3.0.9 421 3/26/2025
3.0.8 435 3/25/2025
3.0.7 469 3/25/2025
3.0.6 439 3/25/2025
3.0.5 439 3/25/2025
3.0.4 450 3/25/2025
3.0.3 445 3/25/2025
3.0.2 373 3/23/2025
3.0.1 92 3/21/2025