PouryaKit.Email 0.1.0-preview.2

This is a prerelease version of PouryaKit.Email.
dotnet add package PouryaKit.Email --version 0.1.0-preview.2
                    
NuGet\Install-Package PouryaKit.Email -Version 0.1.0-preview.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="PouryaKit.Email" Version="0.1.0-preview.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PouryaKit.Email" Version="0.1.0-preview.2" />
                    
Directory.Packages.props
<PackageReference Include="PouryaKit.Email" />
                    
Project file
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 PouryaKit.Email --version 0.1.0-preview.2
                    
#r "nuget: PouryaKit.Email, 0.1.0-preview.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 PouryaKit.Email@0.1.0-preview.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=PouryaKit.Email&version=0.1.0-preview.2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=PouryaKit.Email&version=0.1.0-preview.2&prerelease
                    
Install as a Cake Tool

PouryaKit.Email

NuGet .NET 10 License: MIT

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 Result from 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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