Rask.Mail 0.20.0

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Rask.Mail --version 0.20.0
                    
NuGet\Install-Package Rask.Mail -Version 0.20.0
                    
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="Rask.Mail" Version="0.20.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Rask.Mail" Version="0.20.0" />
                    
Directory.Packages.props
<PackageReference Include="Rask.Mail" />
                    
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 Rask.Mail --version 0.20.0
                    
#r "nuget: Rask.Mail, 0.20.0"
                    
#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 Rask.Mail@0.20.0
                    
#: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=Rask.Mail&version=0.20.0
                    
Install as a Cake Addin
#tool nuget:?package=Rask.Mail&version=0.20.0
                    
Install as a Cake Tool

Rask.Mail

Durable transactional email for a Rask app — queued on the app's own database and delivered off the request thread, with no broker or Redis.

  • Compose with a fluent Email builder; the body is a Rask component rendered to HTML, so an email template is just another component.
  • Call IMailQueue.SendAsync(email) and it persists one QueuedMail row; a background MailProcessor delivers it over SMTP — at-least-once, with exponential-backoff retries up to MaxAttempts (then left as a dead letter for inspection).
  • Delayed send with ScheduleAsync(email, delay).
  • Zero-config in development — with no SMTP configured, mail is logged; point PickupDirectory at a folder to write .eml files instead. Production sends over SMTP via MailKit.

Use

public sealed class WelcomeEmail : Component
{
    public string Name { get; set; } = "";

    protected override Component? Render() =>
        Div()[H1()[$"Welcome, {Name}!"], P()["Thanks for signing up."]];
}

// Program.cs
builder.Services.AddRaskMail<AppDbContext>(o =>
{
    o.From = "hello@example.com";
    o.Smtp = new SmtpOptions { Host = "smtp.example.com", Port = 587, User = "…", Password = "…" };
});

builder.Services.AddDbContextFactory<AppDbContext>(o => o.UseSqlite("Data Source=app.db"));

// AppDbContext.OnModelCreating:  modelBuilder.AddRaskMail();
// then:  rask db add AddMail && rask db update
// send from anywhere IMailQueue is injected:
await mail.SendAsync(Email
    .To(user.Email, user.Name)
    .Subject("Welcome")
    .Body(WelcomeEmail(Name: user.Name)));   // the generated factory, not new (RASK014)

await mail.ScheduleAsync(reminder, delay: TimeSpan.FromHours(24));

Register your context as an IDbContextFactory<AppDbContext>. Several instances is safe: each processor leases the work it claims. On SQLite you will still usually run one, because SQLite is single-writer, so the processor claims work by polling and writing. Use UseRaskSqlite (WAL + a busy_timeout) so a concurrent send waits for the write lock instead of failing.

Part of Rask — the .NET One Person Framework.

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 (3)

Showing the top 3 NuGet packages that depend on Rask.Mail:

Package Downloads
Rask.Dashboard

A built-in operator dashboard for the Rask One Person Framework batteries. Mounts at /_rask and shows the outbox, background jobs, queued mail and cache from the application's own database — queue depth, dead letters, the errors behind them, stored email previews, the recurring-job schedule, SQLite pragmas and backup status. A live log tail is built in, and becomes a searchable history when Rask.Logging is installed. Panels appear only for the batteries the app actually registered. Protected by an authorization policy that fails closed outside Development.

Rask

The one reference a Rask application needs, server or browser. On net10.0 it brings the ASP.NET host plus every battery — database, mediator, background jobs, transactional email, cache, outbox, operator dashboard, durable logs, Web Push, and SQLite snapshots and continuous backup — with RaskApp.Create(args) as the entry point. On net10.0-browser it brings the WebAssembly host, the source-generated mediator, the query cache and remote dispatch. Everything referenced is wired and on; app.Configure(c => c.Jobs.Off()) is how an app does without one. Reference Rask.Server for a lean host with no database.

Rask.Auth

Register, sign in and sign out for a Rask app, on by default. Accounts are backed by ASP.NET Core Identity (versioned password hashing, lockout, security stamps) and exposed through Rask's own host-neutral surface — the same IUserProvider, Authorize component and [Authorize] routes work unchanged on the Server, WebAssembly, island, SPA and meta-framework hosts. Ships built-in overridable /login, /register and /logout pages plus the matching /api/auth endpoints, so a TypeScript front end gets the same flows. Email confirmation and password reset go out through the app's own mail queue, with /confirm-email, /forgot-password and /reset-password pages to match. The first account to register becomes the admin.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.20.1-alpha.0.228 30 9/4/2026
0.20.1-alpha.0.227 30 9/4/2026
0.20.1-alpha.0.226 38 9/4/2026
0.20.1-alpha.0.225 39 9/4/2026
0.20.1-alpha.0.224 35 9/4/2026
0.20.1-alpha.0.223 41 9/4/2026
0.20.1-alpha.0.221 36 9/4/2026
0.20.1-alpha.0.220 36 9/4/2026
0.20.1-alpha.0.217 27 9/4/2026
0.20.1-alpha.0.216 39 9/4/2026
0.20.1-alpha.0.215 38 9/3/2026
0.20.1-alpha.0.213 33 9/3/2026
0.20.1-alpha.0.212 41 9/3/2026
0.20.1-alpha.0.211 44 9/3/2026
0.20.1-alpha.0.210 39 9/3/2026
0.20.1-alpha.0.209 37 9/2/2026
0.20.1-alpha.0.208 37 9/2/2026
0.20.1-alpha.0.207 45 9/2/2026
0.20.1-alpha.0.206 39 9/2/2026
0.20.0 111 8/6/2026
Loading failed