Naravel.Mail.Queue
0.2.0
dotnet add package Naravel.Mail.Queue --version 0.2.0
NuGet\Install-Package Naravel.Mail.Queue -Version 0.2.0
<PackageReference Include="Naravel.Mail.Queue" Version="0.2.0" />
<PackageVersion Include="Naravel.Mail.Queue" Version="0.2.0" />
<PackageReference Include="Naravel.Mail.Queue" />
paket add Naravel.Mail.Queue --version 0.2.0
#r "nuget: Naravel.Mail.Queue, 0.2.0"
#:package Naravel.Mail.Queue@0.2.0
#addin nuget:?package=Naravel.Mail.Queue&version=0.2.0
#tool nuget:?package=Naravel.Mail.Queue&version=0.2.0
Naravel.Mail.Queue
Optional Naravel.Mail adapter that delivers mail through Naravel.Queue: QueueAsync stores only the built message data.
| Fact | Detail |
|---|---|
| Install | dotnet add package Naravel.Mail.Queue |
| Targets | .NET 10 |
| Needs | Naravel.Mail and Naravel.Queue, which NuGet installs with it |
| Runs on | a Naravel.Queue driver and a worker that you register |
What you get
- Queue instead of send.
mailer.To(...).QueueAsync(mailable)builds the message now and leaves the sending to a worker. - Plain data in the queue. Only the addresses, the subject, the text and HTML bodies and the transport name are stored, never the mailable or a type name.
- The transport is fixed when you queue.
manager.Mailer("smtp").To(a).QueueAsync(...)storessmtp, and the worker uses it even ifMail:Defaultchanges. - Placement in one place.
options.Connectionandoptions.Queuechoose where the job goes; the defaults are the queue module's default connection anddefault. - Retries from the queue. A failed send is retried with the job's
MaxAttemptsand backoff.
Quick start
builder.Services.AddQueue(builder.Configuration).AddRedisDriver(builder.Configuration); // AddRedisDriver comes from Naravel.Queue.Redis; any other queue driver package works the same
builder.Services.AddNaravelMail(builder.Configuration);
builder.Services.AddNaravelMailQueue();
await mailer.To(user.Email).QueueAsync(new WelcomeMail(user), ct);
WelcomeMail is your own Mailable, user is your own object and mailer is an injected IMailer. Delivery is at least once, so a worker that stops after the transport accepted the message can send it twice, and attachments are not part of the queued data yet. AddNaravelMailQueue registers neither a queue nor a worker: add AddQueueWorker in the process that should send. Without this package, QueueAsync throws an exception that says what to install.
Related packages
| Package | Adds |
|---|---|
Naravel.Mail |
Mailables, named transports and the fake that this adapter queues |
Naravel.Mail.Smtp |
The SMTP transport that a worker can send through |
Naravel.Queue |
Jobs, retries and the background worker that send the message |
Learn more
- Mail: English guide
- Queue: English guide
- Changelog · Source and issues · MIT license
Part of Naravel: Laravel's names, .NET's type system. All Naravel packages share one version.
| 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
- Naravel.Mail (>= 0.2.0)
- Naravel.Queue (>= 0.2.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Release notes: https://github.com/km-arc/Naravel/releases/tag/v0.2.0 - full history: https://github.com/km-arc/Naravel/blob/main/CHANGELOG.md