NPv.Mail.Abstractions
1.0.0
See the version list below for details.
dotnet add package NPv.Mail.Abstractions --version 1.0.0
NuGet\Install-Package NPv.Mail.Abstractions -Version 1.0.0
<PackageReference Include="NPv.Mail.Abstractions" Version="1.0.0" />
<PackageVersion Include="NPv.Mail.Abstractions" Version="1.0.0" />
<PackageReference Include="NPv.Mail.Abstractions" />
paket add NPv.Mail.Abstractions --version 1.0.0
#r "nuget: NPv.Mail.Abstractions, 1.0.0"
#:package NPv.Mail.Abstractions@1.0.0
#addin nuget:?package=NPv.Mail.Abstractions&version=1.0.0
#tool nuget:?package=NPv.Mail.Abstractions&version=1.0.0
NPv.Common.Mail.Abstractions
A lightweight abstraction for sending email in .NET applications.
Features
IMailSender
interface for sending email.MailRequest
DTO with optional file attachments.SmtpSettings
class for configuration binding viaIOptions<T>
.
Installation
Add a reference to the NuGet package (coming soon):
Install-Package NPv.Common.Mail.Abstractions
Usage
Configure services in Program.cs
builder.Services.Configure<SmtpSettings>(
builder.Configuration.GetSection("Smtp")
);
builder.Services.AddTransient<IMailSender, MailKitMailSender>();
Send an email
var message = new MailRequest
{
To = "recipient@example.com",
Subject = "Welcome!",
HtmlBody = "<p>Hello world!</p>",
Attachments = new List<MailAttachment>
{
new MailAttachment
{
FileName = "hello.txt",
Content = Encoding.UTF8.GetBytes("Hello world!"),
ContentType = "text/plain"
}
}
};
await mailSender.SendAsync(message);
Configuration
"Smtp": {
"ServerName": "smtp.example.com",
"ServerPort": 587,
"UserName": "user@example.com",
"Password": "yourpassword",
"FromAddress": "noreply@example.com",
"FromName": "Example Sender"
}
Author's Note
This library grew out of my long-standing personal interest in structuring and publishing open source packages. Over time, I’ve revisited and refined earlier internal utilities and ideas, giving them a more consistent shape and preparing them for wider reuse. Along the way, I’ve also taken the opportunity to explore how open source distribution and licensing work in the .NET ecosystem.
It’s a small step toward something I’ve always wanted to try — sharing practical, minimal tools that reflect years of learning, experimentation, and refinement.
Hopefully, someone finds it useful.
Nikolai 😛
⚖️ License
MIT — you are free to use this in commercial and open-source software.
Product | Versions 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. 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. |
-
net9.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on NPv.Mail.Abstractions:
Package | Downloads |
---|---|
NPv.Mail
SMTP and templated email sender implementation for NPv.Mail.Abstractions. Provides MailKit-based delivery, Scriban-based template rendering, and seamless configuration via Microsoft.Extensions.Options. Designed for clean architecture, DI integration, and testability. |
GitHub repositories
This package is not used by any popular GitHub repositories.