EmailKit.AspNetCore
1.0.2
dotnet add package EmailKit.AspNetCore --version 1.0.2
NuGet\Install-Package EmailKit.AspNetCore -Version 1.0.2
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="EmailKit.AspNetCore" Version="1.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="EmailKit.AspNetCore" Version="1.0.2" />
<PackageReference Include="EmailKit.AspNetCore" />
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 EmailKit.AspNetCore --version 1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: EmailKit.AspNetCore, 1.0.2"
#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 EmailKit.AspNetCore@1.0.2
#: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=EmailKit.AspNetCore&version=1.0.2
#tool nuget:?package=EmailKit.AspNetCore&version=1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
π§ AspNetCore.EmailKit
AspNetCore.EmailKit is a lightweight yet powerful email service kit designed for ASP.NET Core applications.
It allows you to send emails securely and effortlessly by defining SMTP settings in appsettings.json and calling a single line of code.
π Features
- Simple setup (single service integration)
-
IOptionspattern support with appsettings.json - Automatic configuration via
IServiceCollectionextension - Built-in
ILoggerfor success and error logging - Secure SMTP with TLS/SSL support
- Send email in one line β
await _emailService.SendEmailAsync(...)
π¦ Installation
Install via NuGet:
dotnet add package AspNetCore.EmailKit
Appsettings.json Configuration
"EmailSettings": {
"SmtpServer": "smtp.gmail.com",
"SmtpPort": 587,
"SenderName": "MyApp Mail Service",
"SenderEmail": "noreply@myapp.com",
"UserName": "noreply@myapp.com",
"Password": "app_specific_password"
}
Note: If youβre using Gmail, you must enable 2-Step Verification and create an App Password.
Go to: Google Account β Security β App Passwords β Create New.
Integration in Program.cs / Startup.cs
using AspNetCore.EmailKit.Extensions;
var builder = WebApplication.CreateBuilder(args);
// Register EmailKit
builder.Services.AddEmailKit(builder.Configuration);
var app = builder.Build();
app.Run();
Usage Example
using AspNetCore.EmailKit.Interface;
public class AccountController : ControllerBase
{
private readonly IEmailService _emailService;
public AccountController(IEmailService emailService)
{
_emailService = emailService;
}
[HttpPost("send-confirmation")]
public async Task<IActionResult> SendConfirmationMail(string email)
{
await _emailService.SendEmailAsync(
toEmail: email,
subject: "Email Confirmation",
body: "<h2>Click below to confirm your account</h2>"
);
return Ok("Confirmation email sent successfully.");
}
}
Error Handling & Logging
[Information] Email sent successfully: test@domain.com / Welcome [Error] Error while sending email: Authentication failed.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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 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 is compatible. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- MailKit (>= 4.14.1)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.10)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.10)
- Microsoft.Extensions.Options (>= 9.0.10)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 9.0.10)
- MimeKit (>= 4.14.0)
-
net8.0
- MailKit (>= 4.14.1)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.10)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.10)
- Microsoft.Extensions.Options (>= 9.0.10)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 9.0.10)
- MimeKit (>= 4.14.0)
-
net9.0
- MailKit (>= 4.14.1)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.10)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.10)
- Microsoft.Extensions.Options (>= 9.0.10)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 9.0.10)
- MimeKit (>= 4.14.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.