Soenneker.Email.Mime
11.0.629
Prefix Reserved
dotnet add package Soenneker.Email.Mime --version 11.0.629
NuGet\Install-Package Soenneker.Email.Mime -Version 11.0.629
<PackageReference Include="Soenneker.Email.Mime" Version="11.0.629" />
<PackageVersion Include="Soenneker.Email.Mime" Version="11.0.629" />
<PackageReference Include="Soenneker.Email.Mime" />
paket add Soenneker.Email.Mime --version 11.0.629
#r "nuget: Soenneker.Email.Mime, 11.0.629"
#:package Soenneker.Email.Mime@11.0.629
#addin nuget:?package=Soenneker.Email.Mime&version=11.0.629
#tool nuget:?package=Soenneker.Email.Mime&version=11.0.629
Soenneker.Email.Mime
A configurable MailKit SMTP sender for MimeMessage objects, with retry handling and optional MIME-content logging.
Install
dotnet add package Soenneker.Email.Mime
Configuration
{
"Smtp": {
"Enable": true,
"Host": "smtp.example.com",
"Port": 587,
"Username": "mailer@example.com",
"Password": "use-a-secret-provider",
"UseSsl": false,
"UseStartTls": true,
"AcceptAnyCert": false,
"LogContent": false
}
}
Enable, Host, Port, Username, Password, and UseSsl are required when SMTP is enabled. UseStartTls, AcceptAnyCert, and LogContent default to false. If both TLS flags are true, UseSsl takes precedence and MailKit uses TLS immediately on connection.
Keep credentials in a secret provider rather than source-controlled configuration. Leave AcceptAnyCert false outside isolated development: enabling it disables server-certificate validation and permits interception. If both TLS flags are false, the connection is unencrypted.
Registration
using Microsoft.Extensions.DependencyInjection;
using Soenneker.Email.Mime.Abstract;
using Soenneker.Email.Mime.Registrars;
services.AddMimeUtilAsSingleton();
AddMimeUtilAsScoped() is also available. In that registration, the utility is scoped while its reusable memory-stream dependency remains singleton; disposing a scope does not tear down that shared dependency.
Send a message
using MimeKit;
var message = new MimeMessage();
message.From.Add(MailboxAddress.Parse("mailer@example.com"));
message.To.Add(MailboxAddress.Parse("recipient@example.net"));
message.Subject = "Deployment complete";
message.Body = new TextPart("plain") { Text = "Version 42 is live." };
IMimeUtil mime = serviceProvider.GetRequiredService<IMimeUtil>();
await mime.Send(message, cancellationToken);
When SMTP is disabled, Send and InternalSend log and return without sending. Send retries I/O, socket, timeout, SMTP protocol, and temporary 4xx SMTP command failures five times with exponential backoff and jitter, then rethrows the final failure. Authentication, certificate, invalid-message, and permanent 5xx command failures are not retried. InternalSend performs one attempt and is mainly useful when the caller owns retry behavior.
SMTP delivery is not idempotent: a connection can fail after a server accepts a message but before the client receives confirmation, so any retry strategy can produce duplicates. Use a stable message identifier and downstream deduplication when duplicates are unacceptable. A disconnect failure after an acknowledged send is logged and does not trigger another send.
ConvertMimeMessageToString returns the complete MIME representation, including headers, body, and encoded attachments. LogContent: true writes that data at debug level; leave it disabled when messages may contain personal data, credentials, or confidential attachments.
Cancellation stops pending client work but cannot recall a message already accepted by the SMTP server.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
-
net11.0
- Kevlar (>= 1.5.0)
- MailKit (>= 5.0.0)
- Soenneker.Extensions.Configuration (>= 11.0.917)
- Soenneker.Extensions.Stream (>= 11.0.182)
- Soenneker.Utils.MemoryStream (>= 11.0.1621)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Soenneker.Email.Mime:
| 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.629 | 82 | 11/11/2026 |
| 11.0.628 | 63 | 11/11/2026 |
| 11.0.627 | 66 | 11/11/2026 |
| 11.0.626 | 50 | 11/11/2026 |
| 11.0.622 | 100 | 11/10/2026 |
| 11.0.620 | 209 | 11/3/2026 |
| 11.0.619 | 88 | 11/3/2026 |
| 11.0.618 | 119 | 11/3/2026 |
| 11.0.617 | 93 | 11/3/2026 |
| 11.0.616 | 106 | 11/3/2026 |
| 11.0.615 | 199 | 10/28/2026 |
| 11.0.614 | 108 | 10/27/2026 |
| 11.0.613 | 106 | 10/27/2026 |
| 11.0.612 | 154 | 10/26/2026 |
| 11.0.611 | 100 | 10/26/2026 |
| 11.0.609 | 115 | 10/26/2026 |
| 11.0.608 | 114 | 10/26/2026 |
| 11.0.607 | 91 | 10/26/2026 |
| 11.0.606 | 96 | 10/26/2026 |
| 11.0.605 | 102 | 10/26/2026 |
Updated Multiple NuGet packages