Devity.NETCore.MailKit
2.2.2
dotnet add package Devity.NETCore.MailKit --version 2.2.2
NuGet\Install-Package Devity.NETCore.MailKit -Version 2.2.2
<PackageReference Include="Devity.NETCore.MailKit" Version="2.2.2" />
<PackageVersion Include="Devity.NETCore.MailKit" Version="2.2.2" />
<PackageReference Include="Devity.NETCore.MailKit" />
paket add Devity.NETCore.MailKit --version 2.2.2
#r "nuget: Devity.NETCore.MailKit, 2.2.2"
#:package Devity.NETCore.MailKit@2.2.2
#addin nuget:?package=Devity.NETCore.MailKit&version=2.2.2
#tool nuget:?package=Devity.NETCore.MailKit&version=2.2.2
NETCore.MailKit
MailKit extension to use with ASP.NET Core projects.
Original and why fork
The original version of this library has been created by myloveCc and can be accessed here.
I have been a user of this library for a few years. However, over the time as the library was not maintained, I managed to come across some bugs and I had to re-release the fixes myself for use on my own projects. Furthermore, the last push happened to be a vulnerability in the underyling MailKit library, so I decided to fork the project and continue maintaining it as it's still being used by thousands of projects.
Install with NuGet
Install-Package Devity.NETCore.MailKit
Install with .NET CLI
dotnet add package Devity.NETCore.MailKit
Usage
Add MailKit at start-up
builder.Services.AddMailKit(optionBuilder =>
{
optionBuilder.UseMailKit(new MailKitOptions()
{
// get options from sercets.json
Server = Configuration["Server"],
Port = Convert.ToInt32(Configuration["Port"]),
SenderName = Configuration["SenderName"],
SenderEmail = Configuration["SenderEmail"],
// can be optional with no authentication
Account = Configuration["Account"],
Password = Configuration["Password"],
// enable ssl or tls
Security = true
});
});
Or
Program.cs
var mailKitOptions = builder.Configuration.GetSection("Email").Get<MailKitOptions>();
builder.Services.AddMailKit(config => config.UseMailKit(mailKitOptions));
secrets.json/appsettings.json:
{
"Email": {
"Server": "localhost",
"Port": 25,
"SenderName": "Test Name",
"SenderEmail": "test@test.com"
"Account": "username",
"Password": "password",
"Security": true
}
}
Use EmailService like
public class HomeController : Controller
{
private readonly IEmailService _emailService;
public HomeController(IEmailService emailService)
{
_emailService = emailService;
}
public IActionResult Email()
{
ViewData["Message"] = "ASP.NET Core mvc send email example";
_emailService.Send("xxxx@gmail.com", "ASP.NET Core mvc send email example", "Send from asp.net core mvc action");
return View();
}
}
LICENSE
MIT
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. 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. |
-
net6.0
- MailKit (>= 4.11.0)
- Microsoft.Extensions.DependencyInjection (>= 8.0.1)
-
net7.0
- MailKit (>= 4.11.0)
- Microsoft.Extensions.DependencyInjection (>= 8.0.1)
-
net8.0
- MailKit (>= 4.11.0)
- Microsoft.Extensions.DependencyInjection (>= 8.0.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Devity.NETCore.MailKit:
Package | Downloads |
---|---|
Devity.Mailing
A package with Mailing solution using MailKit. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
2.2.2 | 541 | 4/3/2025 |