Eaf.MailKit 9.4.6

Prefix Reserved
dotnet add package Eaf.MailKit --version 9.4.6
                    
NuGet\Install-Package Eaf.MailKit -Version 9.4.6
                    
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="Eaf.MailKit" Version="9.4.6" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Eaf.MailKit" Version="9.4.6" />
                    
Directory.Packages.props
<PackageReference Include="Eaf.MailKit" />
                    
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 Eaf.MailKit --version 9.4.6
                    
#r "nuget: Eaf.MailKit, 9.4.6"
                    
#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 Eaf.MailKit@9.4.6
                    
#: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=Eaf.MailKit&version=9.4.6
                    
Install as a Cake Addin
#tool nuget:?package=Eaf.MailKit&version=9.4.6
                    
Install as a Cake Tool

Eaf.MailKit

Módulo EAF para envio de e-mails baseado em MailKit, estendendo as abstrações Abp.MailKit com retry, templates e configurações específicas do EAF.

Funcionalidades

  • Envio de e-mails via IEmailSender (MailKit).
  • Retry automático em falhas transitórias do SMTP (até 3 tentativas com backoff exponencial).
  • Templates de e-mail com placeholders {{Nome}} e fallback por tenant.
  • Configurações de certificado SSL/TLS e validação desabilitada para desenvolvimento.
  • Spans do ActivitySource "Eaf.MailKit" para observabilidade (OpenTelemetry).

Instalação

Adicione a dependência ao módulo ABP:

[DependsOn(typeof(EafMailKitModule))]
public class MyProjectModule : AbpModule
{
}

Configuração

As configurações podem ser definidas via ISettingManager ou injetando EafMailKitConfiguration:

Setting Padrão Descrição
Eaf.MailKit.RetryCount 3 Número máximo de tentativas.
Eaf.MailKit.RetryDelayMilliseconds 500 Tempo base entre tentativas (ms).
Eaf.MailKit.DisableCertificateValidation false Desabilita validação do certificado SMTP.

Configure as credenciais SMTP padrão do ABP (Abp.Net.Mail.EmailSettingNames.Smtp.Host, Port, UserName, Password etc.).

Uso

public class MyService
{
    private readonly IEmailSender _emailSender;
    private readonly IEmailTemplateManager _templateManager;

    public MyService(IEmailSender emailSender, IEmailTemplateManager templateManager)
    {
        _emailSender = emailSender;
        _templateManager = templateManager;
    }

    public async Task SendWelcomeEmail(string email, string name)
    {
        var body = await _templateManager.RenderAsync("Welcome", new { Name = name });
        await _emailSender.SendAsync(email, "Bem-vindo", body, isBodyHtml: true);
    }
}

Templates

Armazene templates em memória (padrão) ou substitua IEmailTemplateStore por uma implementação que use banco de dados:

var store = Resolve<IEmailTemplateStore>();

O formato dos placeholders é {{Propriedade}}. Propriedades ausentes são substituídas por vazio.

E-mail com anexos

using var message = new MailMessage("from@example.com", "to@example.com", "Subject", "<h1>Body</h1>")
{
    IsBodyHtml = true
};
message.Attachments.Add(new Attachment("caminho/para/arquivo.pdf"));
await _emailSender.SendAsync(message);

Eaf.MailKit (English)

EAF module for email sending based on MailKit, extending Abp.MailKit abstractions with retry, templates, and EAF-specific configuration.

Features

  • Email sending via IEmailSender (MailKit).
  • Automatic retry on transient SMTP failures (up to 3 attempts with exponential backoff).
  • Email templates with {{Name}} placeholders and tenant fallback.
  • SSL/TLS and certificate validation settings.
  • ActivitySource "Eaf.MailKit" spans for observability (OpenTelemetry).

Configuration

Setting Default Description
Eaf.MailKit.RetryCount 3 Maximum retry attempts.
Eaf.MailKit.RetryDelayMilliseconds 500 Base delay between retries (ms).
Eaf.MailKit.DisableCertificateValidation false Disables SMTP certificate validation.

Also configure ABP SMTP settings (Abp.Net.Mail.EmailSettingNames.Smtp.*).

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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
9.4.6 64 8/18/2026
Loading failed