Athenex.Whimclean.Infrastructure.Email.Smtp 2.0.0

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

Athenex.Whimclean.Infrastructure.Email.Smtp

ภาษาไทย

SMTP implementation of IEmailSender from Athenex.Whimclean.Application, over System.Net.Mail.

Install

dotnet add package Athenex.Whimclean.Infrastructure.Email.Smtp

Register

using Athenex.Whimclean.Infrastructure.Email.Smtp;

services.AddSmtpEmailSender(options =>
{
    options.Host = "smtp.example.com";
    options.Port = 587;
    options.From = "noreply@example.com";
    options.FromName = "Example";
    options.User = "smtp-user";
    options.Password = configuration["Email:Password"];
});

In an ASP.NET Core host, bind and validate the options from the Email section instead and call the registration without a delegate:

using Athenex.Whimclean.Api.AspNetCore.Configuration;
using Athenex.Whimclean.Infrastructure.Email.Smtp;

services.AddValidatedOptions<SmtpEmailOptions>(configuration, SmtpEmailOptions.SectionName, options => options.Validate());
services.AddSmtpEmailSender();

SmtpEmailOptions holds Host, Port (default 587), From, FromName, User, Password, EnableSsl (default true) and TimeoutSeconds (default 30). With the delegate the options are validated when first used; with AddValidatedOptions they are validated at startup. Validate() fails with a message naming the setting when Host or From is missing, Port is not a valid TCP port, or TimeoutSeconds is not positive.

Behavior

  • A message with both bodies is sent as plain text with an HTML alternate view; a single body is sent as is.
  • From on the message overrides the configured sender; ReplyTo, CC, BCC and attachments map directly, attachments keeping their declared content type.
  • EnableSsl negotiates STARTTLS and is on by default; credentials are sent only when User is set. A new SmtpClient with the configured timeout is created per send.
  • The sender is registered with TryAddScoped, so an application-supplied IEmailSender wins.

Repository and full architecture guide: https://github.com/athene-x/Whimclean

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
2.0.0 103 11/17/2026

First release: SMTP email sender and options.