All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- SMTP configuration override per mailer context via
SmtpConfigOverrideproperty onIMailerContext/MailerContextAbstract. Allows sending emails through different SMTP servers depending on the mailer context. OnConfigureSmtpClient(SmtpClient client)hook onIMailerContext/MailerContextAbstract. Override this in your mailer context to configure the full MailKitSmtpClientbefore it connects (e.g.,ServerCertificateValidationCallback,ClientCertificates,ProxyClient,Timeout,AuthenticationMechanisms, etc.).- New
AddAspNetCoreMailKitMailer(Action<SmtpClient>)extension overload for registering services with a client configuration action only. - All existing
AddAspNetCoreMailKitMaileroverloads now accept an optionalAction<SmtpClient>parameter for global client configuration at registration time.
- Refactored
MailClientinternals to reduce duplicated code by extracting_ResolveContext,_ResolveSmtpConfig, and_SendMessageAsynchelper methods. - Updated all dependencies to latest versions:
- MailKit 4.14.1 → 4.15.1
- Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation 10.0.1 → 10.0.5
- Microsoft.Extensions.Configuration 10.0.1 → 10.0.5
- Microsoft.Extensions.Configuration.Binder 10.0.1 → 10.0.5
- Microsoft.Extensions.Options 10.0.1 → 10.0.5
- coverlet.collector 6.0.4 → 8.0.1
- Microsoft.NET.Test.Sdk 18.0.1 → 18.4.0
- Removed unused
RestSharp.Serializers.NewtonsoftJsondependency from integration tests.
- Resolved nullable warnings (CS8601/CS8604) in
MailClient.PrepareMessageforSubjectandEmailproperties.
- Dependency versions have been bumped significantly. If you depend on specific versions of MailKit, MimeKit, or the Microsoft.AspNetCore.* packages, please test your application after upgrading.
- CID (Content-ID) support for inline/embedded images and resources in HTML emails
1. Add a linked resource in your mailer method:
public IMailerContextResult WelcomeMailWithLogo(string email, string logoPath)
{
return this.HtmlMail(
new EmailAddressModel("User", email),
"Welcome!",
new WelcomeModel(),
withAttachments: a => a.AddLinkedResource(logoPath, "company-logo"));
}2. Reference the image in your Razor view using cid::
<img src="cid:company-logo" alt="Logo" />The AddLinkedResource method supports file paths, byte arrays, and URLs. See the README for full documentation.
- Attachments now support byte array and fixed filenames.
- Updated dependencies to latest versions.
- General code improvements and optimizations.
- Added Async Method support for mailer contexts.
- Updated to .NET 10
- Fixed Bug - SMTP connection was not properly disposed after sending an email.
- Updated to .NET 9
- Updated to MailKit 4.11.0
- Updated to Razor 9.0.4
- Updated to HtmlAgilityPack 1.12.1
- Removed Newtonsoft.Json dependency
- Removed obsolete and unused package RestSharp
- Improved nullability annotations
- Resolved a bug where the memory cache for the CSS Inline Style Helper returned empty strings or null instead of reading the actual file.
- Introduced the
GetContentAsyncmethod to render the HTML without sending the mail.
- Upgraded to .NET 8.
- Updated dependencies for .NET 6.
- Updated changelog for 1.1.x.
- Initial .NET 5 release.
- Updated examples.
- Updated documentation.
- Initial release.