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 modes —
SendAll,SendWithRestrictions, orDenyAllOutboundto control whether email leaves the system. - Recipient filtering — optional rules that match recipients by exact address or regular expression.
- Options validation —
MailSettingsValidatorvalidates configuration at startup viaIValidateOptions<MailSettings>. - Transport abstraction — implement
IMailTransportto 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
- Microsoft.Extensions.Logging.Abstractions (>= 5.0.0 && < 6.0.0)
- Microsoft.Extensions.Options (>= 5.0.0 && < 6.0.0)
.NET 6.0
- Microsoft.Extensions.Logging.Abstractions (>= 6.0.0 && < 7.0.0)
- Microsoft.Extensions.Options (>= 6.0.0 && < 7.0.0)
.NET 7.0
- Microsoft.Extensions.Logging.Abstractions (>= 7.0.0 && < 8.0.0)
- Microsoft.Extensions.Options (>= 7.0.0 && < 8.0.0)
.NET 8.0
- No dependencies.
.NET 9.0
- No dependencies.
.NET 10.0
- No dependencies.
.NET Standard 2.0
- Microsoft.Extensions.Logging.Abstractions (>= 3.1.0 && < 4.0.0)
- Microsoft.Extensions.Options (>= 3.1.0 && < 4.0.0)
| Version | Downloads | Last updated |
|---|---|---|
| 1.0.0 | 4 | 2/20/2026 |