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
<PackageReference Include="Soenneker.Extensions.Dtos.Email" Version="11.0.526" />
<PackageVersion Include="Soenneker.Extensions.Dtos.Email" Version="11.0.526" />
<PackageReference Include="Soenneker.Extensions.Dtos.Email" />
paket add Soenneker.Extensions.Dtos.Email --version 11.0.526
#r "nuget: Soenneker.Extensions.Dtos.Email, 11.0.526"
#:package Soenneker.Extensions.Dtos.Email@11.0.526
#addin nuget:?package=Soenneker.Extensions.Dtos.Email&version=11.0.526
#tool nuget:?package=Soenneker.Extensions.Dtos.Email&version=11.0.526
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 | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
-
net11.0
- MimeKit (>= 5.0.0)
- Soenneker.Dtos.Email (>= 11.0.330)
- Soenneker.Extensions.Enumerable (>= 11.0.702)
- Soenneker.Extensions.String (>= 11.0.820)
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 |
Update dependency Soenneker.Dtos.Email to 11.0.330 (#1127)