Soenneker.Extensions.Dtos.Email 11.0.526

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

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

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

Converts EmailDto messages into MimeKit MimeMessage instances, including HTML or plain-text bodies, recipients, attachments, reply-to addresses, and priority headers.

Installation

dotnet add package Soenneker.Extensions.Dtos.Email

Usage

using System.Text;
using Microsoft.Extensions.Logging;
using MimeKit;
using Soenneker.Dtos.Email;
using Soenneker.Dtos.Email.Attachment;
using Soenneker.Enums.Email.Format;
using Soenneker.Enums.Email.Priority;
using Soenneker.Extensions.Dtos.Email;

var email = new EmailDto
{
    Name = "Example App",
    Address = "no-reply@example.com",
    To = ["person@example.com"],
    Cc = ["team@example.com"],
    ReplyTo = "support@example.com",
    Subject = "Your export is ready",
    Body = "<p>The export is attached.</p>",
    Format = EmailFormat.Html,
    Priority = EmailPriority.Normal,
    Attachments =
    [
        new EmailAttachmentDto
        {
            FileName = "export.csv",
            MimeType = "text/csv",
            Data = Encoding.UTF8.GetBytes("id,name\n1,Example")
        }
    ]
};

MimeMessage message = email.ToMimeMessage(logger);

EmailFormat.Plaintext creates a text/plain body; other format values create text/html. Attachments produce a multipart/mixed body with the text part first. Attachment bytes are wrapped in streams owned by the returned MIME structure, so dispose the MimeMessage after it has been sent or serialized.

High priority adds X-Priority: 1, Priority: urgent, and Importance: high. Low priority adds the corresponding low-priority values. Normal priority adds no priority headers.

Validation and recipient handling

The DTO must provide a non-whitespace subject, body, sender address, and at least one usable To address. Missing required message data throws InvalidOperationException; a null DTO throws ArgumentNullException.

Whitespace-only entries in To, Cc, or Bcc are skipped and logged without including recipient addresses in the log. At least one To entry must remain after filtering. MimeKit validates nonblank sender and recipient syntax and can throw for malformed addresses. ReplyTo is omitted when blank and otherwise follows the same MimeKit address validation.

Product Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
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
11.0.526 0 11/15/2026
11.0.525 0 11/14/2026
11.0.524 74 11/11/2026
11.0.523 62 11/11/2026
11.0.522 52 11/11/2026
11.0.520 64 11/11/2026
11.0.519 70 11/11/2026
11.0.517 70 11/11/2026
11.0.515 73 11/11/2026
11.0.514 68 11/11/2026
11.0.513 85 11/11/2026
11.0.512 70 11/10/2026
11.0.511 68 11/10/2026
11.0.510 87 11/10/2026
11.0.509 178 11/3/2026
11.0.508 117 11/3/2026
11.0.507 117 11/3/2026
11.0.506 93 11/2/2026
11.0.505 204 10/27/2026
11.0.504 130 10/27/2026
Loading failed

Update dependency Soenneker.Dtos.Email to 11.0.330 (#1127)