Class FailoverEmailProvider
- Namespace
- MailForge
- Assembly
- MailForge.dll
An IEmailProvider that tries a precedence-ordered chain of providers until one succeeds. Each provider is governed by a ProviderFailoverRoute that defines its failover FailoverPolicy and attempt budget. When every route is exhausted an aggregate EmailException is thrown whose IsTransient reflects whether any failure was retryable.
public sealed class FailoverEmailProvider : IEmailProvider
- Inheritance
-
FailoverEmailProvider
- Implements
- Inherited Members
Constructors
FailoverEmailProvider(params IEmailProvider[])
Creates a failover provider with one default route per provider, in precedence order.
public FailoverEmailProvider(params IEmailProvider[] providers)
Parameters
providersIEmailProvider[]
FailoverEmailProvider(params ProviderFailoverRoute[])
Creates a failover provider from routes listed in precedence order.
public FailoverEmailProvider(params ProviderFailoverRoute[] routes)
Parameters
routesProviderFailoverRoute[]
FailoverEmailProvider(IEnumerable<ProviderFailoverRoute>?)
Creates a failover provider from an ordered list of routes.
public FailoverEmailProvider(IEnumerable<ProviderFailoverRoute>? routes)
Parameters
routesIEnumerable<ProviderFailoverRoute>
Properties
Capabilities
The capabilities supported by every provider in the chain. A message that any single provider cannot carry (for example, an attachment) is not safe to route.
public ProviderCapabilities Capabilities { get; }
Property Value
Name
The name of the provider chain.
public string Name { get; }
Property Value
Methods
SendAsync(EmailMessage, CancellationToken)
Sends message through the first route and fails over to the next
while failures match each route's policy, stopping at the first success.
public Task<ProviderDeliveryResult> SendAsync(EmailMessage message, CancellationToken cancellationToken = default)
Parameters
messageEmailMessagecancellationTokenCancellationToken