Mitc.Email.Abstractions 1.0.0

Mitc.Email.Abstractions

Abstractions and default implementation for sending email in MITC applications. Provides a MailService that routes outbound email through a pluggable IMailTransport, with configurable recipient filtering and service modes.

Features

  • Service modesSendAll, SendWithRestrictions, or DenyAllOutbound to control whether email leaves the system.
  • Recipient filtering — optional rules that match recipients by exact address or regular expression.
  • Options validationMailSettingsValidator validates configuration at startup via IValidateOptions<MailSettings>.
  • Transport abstraction — implement IMailTransport to plug in any email provider (SMTP, SendGrid, etc.).

Configuration

Add MailSettings to your configuration (e.g. appsettings.json):

{
  "MailSettings": {
    "ServiceMode": "SendWithRestrictions",
    "FromAddress": "no-reply@example.com",
    "RecipientFilterRules": [
      { "AddressType": "Literal", "RecipientAddress": "allowed@example.com" },
      { "AddressType": "RegEx", "RecipientAddress": "@example\\.com$" }
    ]
  }
}

Registration

services.Configure<MailSettings>(configuration.GetSection("MailSettings"));
services.AddSingleton<IValidateOptions<MailSettings>, MailSettingsValidator>();
services.AddTransient<MailService>();
services.AddTransient<IMailTransport, MySmtpTransport>(); // your implementation

Usage

await mailService.SendAsync(new SendEmailRequest(
    address: "user@example.com",
    subject: "Welcome",
    body: "<p>Hello!</p>"
));

Showing the top 20 packages that depend on Mitc.Email.Abstractions.

Packages Downloads
Mitc.Email.SendGrid
SendGrid implementation of IMailTransport for Mitc.Email.Abstractions.
4
Mitc.Email.Templating
Blazor-based email templating service with strongly-typed models and integrated sending via Mitc.Email.Abstractions.
4

.NET 5.0

.NET 6.0

.NET 7.0

.NET 8.0

  • No dependencies.

.NET 9.0

  • No dependencies.

.NET 10.0

  • No dependencies.

.NET Standard 2.0

Version Downloads Last updated
1.0.0 4 2/20/2026