Class InMemoryEmailNotificationChannel

Assembly: redb.Identity.Core.dll

N-4 (Session C): test / preview implementation of
. Captures every dispatched message in an
in-memory ring (default cap = 256 messages) instead of sending it out. Used in
integration tests to assert that the right templated e-mail reached the right
recipient with the right variables.

public sealed class InMemoryEmailNotificationChannel : IEmailNotificationChannel

Inheritance

Object→InMemoryEmailNotificationChannel

Implements

Properties

Messages

Snapshot of all messages captured so far, oldest first.

public IReadOnlyList<CapturedEmail> Messages { get; }

Methods

Clear()

Drops all captured messages.

public void Clear()

ForRecipient(string)

All messages directed at the given recipient (case-insensitive match).

public IReadOnlyList<CapturedEmail> ForRecipient(string to)

SendTemplateAsync(string, string, IReadOnlyDictionary<string, string>, CancellationToken)

Renders templateId with the supplied vars and

public Task SendTemplateAsync(string to, string templateId, IReadOnlyDictionary<string, string> vars, CancellationToken ct = default)

Constructors

Remarks

Production hosts MUST replace this with a real SMTP / SendGrid / SES channel.
Registering this singleton in production silently swallows every notification.