AugusteVN.MailKit.SmtpMailer
1.2.0
dotnet add package AugusteVN.MailKit.SmtpMailer --version 1.2.0
NuGet\Install-Package AugusteVN.MailKit.SmtpMailer -Version 1.2.0
<PackageReference Include="AugusteVN.MailKit.SmtpMailer" Version="1.2.0" />
<PackageVersion Include="AugusteVN.MailKit.SmtpMailer" Version="1.2.0" />
<PackageReference Include="AugusteVN.MailKit.SmtpMailer" />
paket add AugusteVN.MailKit.SmtpMailer --version 1.2.0
#r "nuget: AugusteVN.MailKit.SmtpMailer, 1.2.0"
#:package AugusteVN.MailKit.SmtpMailer@1.2.0
#addin nuget:?package=AugusteVN.MailKit.SmtpMailer&version=1.2.0
#tool nuget:?package=AugusteVN.MailKit.SmtpMailer&version=1.2.0
MailKit SMTP Mailer
Send emails using MailKit over SMTP using to be configured with a existing e-mail account.
Configuration
appsettings.json
{
"SmtpConfig": {
"Host": "<to-fill>",
"Port": 465,
"UseSsl": true,
"Email": "<to-fill>",
"Password": "<to-fill>",
"Name": "<from-name-optional>"
}
}
Program.cs
builder.Services
.AddOptions<SmtpConfig>()
.BindConfiguration(nameof(SmtpConfig));
builder.Services.AddSingleton<ISmtpMailer, SmtpMailer>();
// Or initialize an instance.
var smtpMailer = new SmtpMailer(
new SmtpConfig {
Host = "<to-fill>",
Port = 465,
UseSsl = true,
Email = "<to-fill>",
Password = "<to-fill>",
Name = "<from-name-optional>"
});
Send Email
Program.cs
app.MapPost("/", async (ISmtpMailer smtpMailer) => {
await smtpMailer.SendAsync(
subject: "",
body: "",
new Recipients { To = "", ReplyTo = null, Cc = null, Bcc = null },
headers: null);
// Or use the overload and construct your own 'MimeMessage'.
await smtpMailer.SendAsync(
new MimeMessage {
Subject = "",
...
});
return Results.NoContent();
});
To see it in action, watch: .NET 8 New Identity Endpoints Implemented in C#.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. |
-
net10.0
- MailKit (>= 4.17.0)
- Microsoft.Extensions.Options (>= 10.0.0)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on AugusteVN.MailKit.SmtpMailer:
| Package | Downloads |
|---|---|
|
AugusteVN.Modules.Auth.Api
Minimal API endpoints for authentication, identity, roles, and user management |
|
|
AugusteVN.Modules.Payments.Api
Minimal API endpoints for payments, plans, and subscriptions |
|
|
AugusteVN.Modules.EmailCampaigns.Api
Minimal API endpoints for campaigns, templates, subscribers, and jobs |
|
|
AugusteVN.Modules.Contact.Api
Minimal API endpoint for contact form submissions |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.2.0 | 300 | 7/9/2026 |
| 1.1.2 | 758 | 12/26/2023 |
| 1.1.1 | 286 | 12/21/2023 |
| 1.1.0 | 342 | 11/23/2023 |
| 1.0.9 | 1,464 | 11/18/2023 |
| 1.0.8 | 626 | 11/12/2023 |
| 1.0.7 | 216 | 11/5/2023 |
| 1.0.6 | 176 | 11/5/2023 |
| 1.0.5 | 199 | 11/5/2023 |
| 1.0.4 | 191 | 11/5/2023 |
| 1.0.3 | 229 | 10/29/2023 |
| 1.0.2 | 210 | 10/29/2023 |
| 1.0.1 | 185 | 10/27/2023 |
| 1.0.0 | 203 | 10/27/2023 |
Upgraded to .NET 10.