Mailer
Overview
VersaTul.Mailer provides SMTP-based email delivery behind a small abstraction layer.
It supports plain text and HTML messages, multiple attachment styles, and token-based templated mail while keeping SMTP configuration separate from dispatch code.
Why Use This Package
Use this package when email delivery is becoming a reusable application capability instead of an isolated SMTP call.
Its main value is separating SMTP settings, dispatch concerns, and attachment handling from the calling workflow.
When To Use This Package
Use this package when you want to:
Send SMTP email without binding application code directly to
SmtpClient.Send HTML or plain-text messages.
Attach files using either
Attachmentor abstract mail attachment models.Generate outbound mail from a tokenized template.
Reuse one dispatcher across notifications, export delivery, and alerting flows.
Installation
Install the package with the .NET CLI:
dotnet add package VersaTul.Mailer
Or with the Package Manager Console:
PM> NuGet\Install-Package VersaTul.Mailer -Version latest
Start Here If
You need to send operational notifications, reports, or export files through SMTP.
You want calling code to avoid direct dependency on
SmtpClient.Message templates or attachment payloads are part of the workflow.
Not The Right First Package If
You only need local file logging rather than outbound delivery.
You are generating export files but do not yet need to send them.
Your team needs a full email-template management system rather than an SMTP delivery layer.
Works Well With
Collection Streamers when attachments are generated from collections or readers.
Logger Mail when operational alerts should be delivered through email.
Configuration and Configuration Defaults when mail settings need to stay explicit and reusable.
Core Types And Concepts
IMailDispatcherandMailDispatcherMain delivery abstraction and implementation.
IMailConfigurationandMailConfigurationExpose SMTP host, credentials, sender/recipient, attachment size, timeout, and retry settings.
ISmtpClientandSmtpClientWrapperWrapper abstraction around SMTP transport.
Key Capabilities
Send plain text messages.
Send HTML messages.
Send messages with
Attachmentcollections.Send messages with abstract
IMailAttachmentpayloads.Send tokenized template messages through
SendTemplatedMail().
Basic Example
using VersaTul.Configurations;
using VersaTul.Mailer;
using VersaTul.Mailer.Configurations;
using VersaTul.Mailer.SmtpClients;
var configSettings = new ConfigSettings
{
{ "FromAddress", "alerts@domain.com" },
{ "ToAddress", "ops@domain.com" },
{ "SmtpServer", "127.0.0.1" },
{ "SmtpPort", 25 },
{ "SmtpUserName", "smtp-user" },
{ "SmtpPassword", "smtp-password" },
{ "MaxAttachmentSize", 10000000 }
};
var configuration = new MailConfiguration(configSettings);
var smtpClient = new SmtpClientWrapper(configuration);
var dispatcher = new MailDispatcher(smtpClient);
dispatcher.SendMail(configuration.FromAddress, configuration.ToAddress, "Subject", "Body", isHtml: false);
Template Example
dispatcher.SendTemplatedMail(
configuration.FromAddress,
configuration.ToAddress,
"Welcome",
"<p>Hello {{FirstName}}, your order {{OrderNumber}} is ready.</p>",
new Dictionary<string, string>
{
["FirstName"] = "Jane",
["OrderNumber"] = "ORD-1001"
});
Expected Result
When this package is working well:
SMTP configuration stays outside the delivery call site,
the same dispatcher can send plain text, HTML, and attachment-based messages, and
workflows such as reporting, alerts, and notifications can reuse one transport abstraction.
Next Step
Read Collection Streamers if the next requirement is generating attachment content.
Read Logger Mail if the next requirement is email-backed logging.
Read Configuration if you want to centralize the mail settings model more explicitly.
Notes
MailConfigurationalso exposesSmtpTimeoutMilliseconds,RetryCount, andRetryDelayMilliseconds.The package focuses on delivery, not mail-template storage or rendering engines.
This package is the transport layer used by Logger Mail and mail-based export workflows.