MailKitSimplified.Sender
1.1.4
See the version list below for details.
dotnet add package MailKitSimplified.Sender --version 1.1.4
NuGet\Install-Package MailKitSimplified.Sender -Version 1.1.4
<PackageReference Include="MailKitSimplified.Sender" Version="1.1.4" />
paket add MailKitSimplified.Sender --version 1.1.4
#r "nuget: MailKitSimplified.Sender, 1.1.4"
// Install MailKitSimplified.Sender as a Cake Addin #addin nuget:?package=MailKitSimplified.Sender&version=1.1.4 // Install MailKitSimplified.Sender as a Cake Tool #tool nuget:?package=MailKitSimplified.Sender&version=1.1.4
MailKitSimplified
![Release](https://github.com/danzuep/MailKitSimplified/actions/workflows/release.yml/badge.svg)
Sending and receiving emails sounds simple, after all, electronic mail existed decades before the Internet. If you're looking for an all-in-one .NET solution for email, you'll quickly discover MailKit is recommended by even the likes of Microsoft due to how it implements the RFC standard. Unfortunately the downside of doing it all is that MailKit can be difficult to set up and use, especially the first time you go to try something like working with attachments or writing a reply. The aim of this package is to make sending and receiving emails as simple as possible!
SMTP with MailKitSimplified.Sender
![Downloads](https://img.shields.io/nuget/dt/MailKitSimplified.Sender.svg?style=flat-square)
Sending an email with MailKitSimplified.Sender is as easy as:
using var smtpSender = SmtpSender.Create("localhost");
await smtpSender.WriteEmail.To("test@localhost").SendAsync();
IMAP with MailKitSimplified.Receiver
![Downloads](https://img.shields.io/nuget/dt/MailKitSimplified.Receiver.svg?style=flat-square)
Receiving emails with MailKitSimplified.Receiver is as easy as:
using var imapReceiver = ImapReceiver.Create("localhost");
var mimeMessages = await imapReceiver.ReadMail.GetMimeMessagesAsync();
Example Usage
The examples above will actually work with no other setup if you use something like smtp4dev, but below are some more realistic examples.
Sending Mail
using var smtpSender = SmtpSender.Create("mail.example.com:587")
.SetCredential("U5ern@m3", "P455w0rd")
.SetProtocolLog("Logs/SmtpClient.txt");
await smtpSender.WriteEmail
.From("my.name@example.com")
.To("YourName@example.com")
.Bcc("admin@example.com")
.Subject("Hello World")
.BodyHtml("<p>Hi</p>")
.Attach("appsettings.json")
.TryAttach(@"Logs\ImapClient.txt")
.SendAsync();
See the MailKitSimplified.Sender wiki for more information.
Receiving Mail
using var imapReceiver = ImapReceiver.Create("imap.example.com:993")
.SetCredential("U5ern@m3", "P455w0rd")
.SetProtocolLog("Logs/ImapClient.txt");
var mimeMessages = await imapReceiver.ReadFrom("INBOX")
.Skip(0).Take(10).GetMimeMessagesAsync();
To just download the email parts you want to use:
var messageSummaries = await imapReceiver.ReadFrom("INBOX/Subfolder")
.GetMessageSummariesAsync(MessageSummaryItems.UniqueId);
See the MailKitSimplified.Receiver wiki for more information.
See Also
Examples of things like dependency injection, a hosted service, or an ASP.NET API can also be found in the GitHub samples.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. 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 was computed. 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 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- MailKit (>= 3.4.2)
- Microsoft.Extensions.Configuration.Abstractions (>= 7.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 7.0.0)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 7.0.0)
- MimeKit (>= 3.4.2)
- System.ComponentModel.Annotations (>= 5.0.0)
- System.IO.Abstractions (>= 17.2.26)
-
net6.0
- MailKit (>= 3.4.2)
- Microsoft.Extensions.Configuration.Abstractions (>= 7.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 7.0.0)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 7.0.0)
- MimeKit (>= 3.4.2)
- System.ComponentModel.Annotations (>= 5.0.0)
- System.IO.Abstractions (>= 17.2.26)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on MailKitSimplified.Sender:
Package | Downloads |
---|---|
MailKitSimplified.Email
Easy, fluent way to send, receive, forward, and reply to emails with MailKit. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
2.11.13-tags-v2-11-13-b0001 | 53 | 8/27/2024 |
2.11.13-tags-v2-11-13-a0001 | 56 | 8/25/2024 |
2.11.12 | 77 | 8/25/2024 |
2.11.10 | 84 | 8/21/2024 |
2.11.9 | 148 | 8/7/2024 |
2.10.0 | 1,058 | 5/1/2024 |
2.9.0 | 2,402 | 12/15/2023 |
2.8.0 | 1,864 | 10/24/2023 |
2.7.0 | 670 | 9/28/2023 |
2.6.1 | 391 | 9/20/2023 |
2.6.0 | 319 | 9/20/2023 |
2.5.8 | 287 | 9/20/2023 |
2.5.7 | 318 | 9/19/2023 |
2.5.6 | 295 | 9/18/2023 |
2.5.5 | 411 | 9/14/2023 |
2.5.4 | 564 | 8/21/2023 |
2.5.3 | 355 | 8/19/2023 |
2.5.2 | 484 | 8/11/2023 |
2.5.1 | 479 | 7/30/2023 |
2.5.0 | 446 | 7/29/2023 |
2.4.7 | 1,222 | 1/25/2023 |
2.4.6 | 594 | 1/15/2023 |
2.4.5 | 566 | 1/15/2023 |
2.4.3 | 551 | 1/14/2023 |
2.4.2 | 589 | 1/10/2023 |
2.4.1 | 634 | 1/10/2023 |
2.4.0 | 641 | 12/12/2022 |
2.3.0 | 569 | 12/9/2022 |
2.2.0 | 589 | 12/6/2022 |
2.1.0 | 646 | 12/2/2022 |
2.0.0 | 615 | 12/1/2022 |
1.1.4 | 647 | 11/25/2022 |
1.1.3 | 592 | 11/24/2022 |
1.1.2 | 621 | 11/21/2022 |
1.1.1 | 627 | 11/17/2022 |
1.0.1 | 634 | 11/16/2022 |
0.2.1 | 674 | 11/12/2022 |
0.2.0 | 646 | 11/12/2022 |
0.1.3 | 651 | 11/11/2022 |
0.1.2.3 | 743 | 10/10/2022 |