PouryaKit.Email
0.1.0-preview.2
dotnet add package PouryaKit.Email --version 0.1.0-preview.2
NuGet\Install-Package PouryaKit.Email -Version 0.1.0-preview.2
<PackageReference Include="PouryaKit.Email" Version="0.1.0-preview.2" />
<PackageVersion Include="PouryaKit.Email" Version="0.1.0-preview.2" />
<PackageReference Include="PouryaKit.Email" />
paket add PouryaKit.Email --version 0.1.0-preview.2
#r "nuget: PouryaKit.Email, 0.1.0-preview.2"
#:package PouryaKit.Email@0.1.0-preview.2
#addin nuget:?package=PouryaKit.Email&version=0.1.0-preview.2&prerelease
#tool nuget:?package=PouryaKit.Email&version=0.1.0-preview.2&prerelease

PouryaKit.Email
One contract that sends a plain-text mail and returns a Result. IEmailSender sends one mail to one recipient, and a Module references only this contract and never names the provider. Mail goes out from a Notification Handler, after the Operation that raised the Domain Event committed, so a rolled-back Operation sends no mail.
Install
dotnet add package PouryaKit.Email --prerelease
When to use it
- An Operation's outcome is mailed to someone: a welcome, a receipt, a notice.
- You need to know what a rolled-back Operation or a failed delivery does to a mail.
PouryaKit.Email.MailKit is the Host's provider, and PouryaKit.Messaging holds the Notification Handler it sends from.
Quick start
Send from a Notification Handler, as the Kit's tests do:
internal sealed record NoteMailedDomainEvent(string To, string Text) : DomainEvent;
internal sealed class MailNoteNotificationHandler(IEmailSender email)
: INotificationHandler<NoteMailedDomainEvent>
{
public Task<Result> Handle(
NoteMailedDomainEvent domainEvent,
CancellationToken cancellationToken
) =>
email.SendAsync(
new EmailMessage(
domainEvent.To,
domainEvent.Text,
$"The note {domainEvent.Text} is written."
),
cancellationToken
);
}
What you get
- A
Resultfrom each send, which the Notification Handler returns. A server that cannot be reached, refuses the login or refuses the mail throws, and the delivery is retried. - No mail for a rolled-back Operation.
- A committed Operation's mail attempted by a durable delivery, retried and in the end set aside as a dead letter with its reason.
A mail may be sent twice. Mail is not transactional: when the delivery that sent a mail fails afterwards, its retry sends the mail again. Send last in the handler, and give each mail its own Notification Handler.
Learn more
| 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
- PouryaKit.Domain (>= 0.1.0-preview.2)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on PouryaKit.Email:
| Package | Downloads |
|---|---|
|
PouryaKit.Email.MailKit
The Host's SMTP sender on MailKit, configured from options the Host validates before it serves. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.0-preview.2 | 73 | 11/1/2026 |
| 0.1.0-preview.1 | 72 | 10/31/2026 |
| 0.1.0-preview.0.28 | 71 | 10/26/2026 |