Soenneker.Email.Dispatcher
4.0.421
Prefix Reserved
dotnet add package Soenneker.Email.Dispatcher --version 4.0.421
NuGet\Install-Package Soenneker.Email.Dispatcher -Version 4.0.421
<PackageReference Include="Soenneker.Email.Dispatcher" Version="4.0.421" />
<PackageVersion Include="Soenneker.Email.Dispatcher" Version="4.0.421" />
<PackageReference Include="Soenneker.Email.Dispatcher" />
paket add Soenneker.Email.Dispatcher --version 4.0.421
#r "nuget: Soenneker.Email.Dispatcher, 4.0.421"
#:package Soenneker.Email.Dispatcher@4.0.421
#addin nuget:?package=Soenneker.Email.Dispatcher&version=4.0.421
#tool nuget:?package=Soenneker.Email.Dispatcher&version=4.0.421
Soenneker.Email.Dispatcher
Routes an EmailMessage either to Azure Service Bus or directly to an IEmailSender, based on the Email:UseQueue configuration value.
Install
dotnet add package Soenneker.Email.Dispatcher
Configure routing
{
"Email": {
"UseQueue": false
}
}
The value is required and is read when EmailDispatcher is constructed. Changing configuration afterward does not change an existing dispatcher's route.
Register an IEmailSender, then choose the dispatcher lifetime that matches the consuming application:
using Microsoft.Extensions.DependencyInjection;
using Soenneker.Email.Dispatcher.Abstract;
using Soenneker.Email.Dispatcher.Registrars;
using Soenneker.Email.Senders.Abstract;
services.AddSingleton<IEmailSender, AppEmailSender>();
services.AddEmailDispatcherAsSingleton();
The singleton registration also registers the queue utility as singleton. Its IEmailSender dependency must be safe to capture and use for the application lifetime. Use AddEmailDispatcherAsScoped() with a scoped sender when dispatch behavior depends on request-scoped services.
Both registrations add the email utility and its Service Bus transmitter dependencies. An IEmailSender registration is still required even when queue routing is enabled because the dispatcher receives both routes through its constructor.
Dispatch a message
IEmailDispatcher dispatcher = serviceProvider.GetRequiredService<IEmailDispatcher>();
await dispatcher.Dispatch(message, cancellationToken);
With UseQueue: true, completion means the message was accepted by the configured Service Bus transmitter; delivery occurs later. With UseQueue: false, completion means the sender returned true. A false result from the sender becomes an InvalidOperationException so a failed direct send is not silently treated as success.
Cancellation stops pending work when the underlying route observes the token; it cannot retract a message already queued or sent.
| 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
- Soenneker.Email.Senders.Abstract (>= 4.0.174)
- Soenneker.Email.Util (>= 4.0.645)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Soenneker.Email.Dispatcher:
| Package | Downloads |
|---|---|
|
Soenneker.Email.Support
A utility that allows for quick access to support email sending |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.421 | 0 | 9/4/2026 |
| 4.0.419 | 0 | 9/4/2026 |
| 4.0.418 | 0 | 9/4/2026 |
| 4.0.417 | 76 | 9/1/2026 |
| 4.0.416 | 69 | 9/1/2026 |
| 4.0.415 | 83 | 9/1/2026 |
| 4.0.414 | 85 | 9/1/2026 |
| 4.0.413 | 83 | 9/1/2026 |
| 4.0.412 | 89 | 8/31/2026 |
| 4.0.411 | 106 | 8/31/2026 |
| 4.0.410 | 63 | 8/31/2026 |
| 4.0.409 | 90 | 8/31/2026 |
| 4.0.408 | 72 | 8/31/2026 |
| 4.0.407 | 114 | 8/30/2026 |
| 4.0.406 | 65 | 8/30/2026 |
| 4.0.405 | 129 | 8/30/2026 |
| 4.0.403 | 65 | 8/29/2026 |
| 4.0.402 | 236 | 8/27/2026 |
| 4.0.401 | 133 | 8/27/2026 |
| 4.0.400 | 129 | 8/26/2026 |
Updated Multiple NuGet packages