Serilog.Sinks.Email
4.2.1
Prefix Reserved
dotnet add package Serilog.Sinks.Email --version 4.2.1
NuGet\Install-Package Serilog.Sinks.Email -Version 4.2.1
<PackageReference Include="Serilog.Sinks.Email" Version="4.2.1" />
<PackageVersion Include="Serilog.Sinks.Email" Version="4.2.1" />
<PackageReference Include="Serilog.Sinks.Email" />
paket add Serilog.Sinks.Email --version 4.2.1
#r "nuget: Serilog.Sinks.Email, 4.2.1"
#:package Serilog.Sinks.Email@4.2.1
#addin nuget:?package=Serilog.Sinks.Email&version=4.2.1
#tool nuget:?package=Serilog.Sinks.Email&version=4.2.1
Serilog.Sinks.Email

Sends log events by SMTP email.
ℹ️ Version 3.x of this package changes the name and structure of many configuration parameters from their 2.x names; see below for detailed information.
Package Id: Serilog.Sinks.Email
await using var log = new LoggerConfiguration()
.WriteTo.Email(
from: "app@example.com",
to: "support@example.com",
host: "smtp.example.com")
.CreateLogger();
Supported options are:
| Parameter | Description |
|---|---|
from |
The email address emails will be sent from. |
to |
The email address emails will be sent to. Multiple addresses can be separated with commas or semicolons. |
host |
The SMTP server to use. |
port |
The port used for the SMTP connection. The default is 25. |
connectionSecurity |
Choose the security applied to the SMTP connection. This enumeration type is supplied by MailKit. The default is Auto. |
credentials |
The network credentials to use to authenticate with the mail server. |
subject |
A message template describing the email subject. The default is "Log Messages". |
body |
A message template describing the format of the email body. The default is "{Timestamp} [{Level}] {Message}{NewLine}{Exception}". |
formatProvider |
Supplies culture-specific formatting information. The default is to use the current culture. |
An overload accepting EmailSinkOptions can be used to specify advanced options such as batched and/or HTML body templates.
Sending batch email
To send batch email, supply WriteTo.Email with a batch size:
await using var log = new LoggerConfiguration()
.WriteTo.Email(
options: new()
{
From = "app@example.com",
To = "support@example.com",
Host = "smtp.example.com",
},
batchingOptions: new()
{
BatchSizeLimit = 10,
BufferingTimeLimit = TimeSpan.FromSeconds(30),
})
.CreateLogger();
Batch formatting can be customized using options.Body.
Sending HTML email
To send HTML email, specify a custom IBatchTextFormatter in options.Body and set options.IsBodyHtml to true:
await using var log = new LoggerConfiguration()
.WriteTo.Email(
options: new()
{
From = "app@example.com",
To = "support@example.com",
Host = "smtp.example.com",
Body = new MyHtmlBodyFormatter(),
IsBodyHtml = true,
},
batchingOptions: new()
{
BatchSizeLimit = 10,
BufferingTimeLimit = TimeSpan.FromSeconds(30),
})
.CreateLogger();
A simplistic HTML formatter is shown below:
class MyHtmlBodyFormatter : IBatchTextFormatter
{
public void FormatBatch(IEnumerable<LogEvent> logEvents, TextWriter output)
{
output.Write("<table>");
foreach (var logEvent in logEvents)
{
output.Write("<tr>");
Format(logEvent, output);
output.Write("</tr>");
}
output.Write("</table>");
}
public void Format(LogEvent logEvent, TextWriter output)
{
using var buffer = new StringWriter();
logEvent.RenderMessage(buffer);
output.Write(WebUtility.HtmlEncode(buffer.ToString()));
}
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 is compatible. net463 was computed. net47 was computed. net471 is compatible. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.6.2
-
.NETFramework 4.7.1
-
.NETStandard 2.0
-
net6.0
-
net8.0
-
net9.0
NuGet packages (32)
Showing the top 5 NuGet packages that depend on Serilog.Sinks.Email:
| Package | Downloads |
|---|---|
|
Azasp.Core
Package Description |
|
|
TianCheng.Model
实体对象基类,及其常用操作。 常用操作包括:对象转换、序列化、日志、常用异常处理、依赖注入。 |
|
|
Zavi.Extensions.Logging
Package Description |
|
|
Netsun.Forms
MVC forms and resources management - internal company package |
|
|
CodeZero
CodeZero is a set of common implementations to help you implementing Clean Architecture, DDD, CQRS, Specification Patterns and another facilities for new modern web applications is an open-source project written in .NET Core. |
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on Serilog.Sinks.Email:
| Repository | Stars |
|---|---|
|
OmniGUI/OmniGUI
A cross-platform GUI framework from scratch just to learn
|
| Version | Downloads | Last Updated |
|---|---|---|
| 4.2.1 | 44,936 | 4/30/2026 |
| 4.2.1-dev-02317 | 106 | 4/30/2026 |
| 4.2.1-dev-02316 | 100 | 4/30/2026 |
| 4.2.0 | 95,168 | 3/6/2026 |
| 4.2.0-dev-02315 | 98 | 4/30/2026 |
| 4.2.0-dev-02311 | 123 | 3/6/2026 |
| 4.2.0-dev-02310 | 106 | 3/6/2026 |
| 4.1.1-dev-02309 | 136 | 3/6/2026 |
| 4.1.1-dev-02308 | 108 | 3/6/2026 |
| 4.1.0 | 696,213 | 4/19/2025 |
| 4.1.0-dev-02303 | 286 | 4/19/2025 |
| 4.1.0-dev-02301 | 561 | 4/8/2025 |
| 4.0.1-dev-00185 | 298 | 4/8/2025 |
| 4.0.0 | 983,272 | 6/9/2024 |
| 4.0.0-dev-00177 | 241 | 6/9/2024 |
| 3.0.0 | 279,478 | 2/29/2024 |
| 3.0.0-dev-00174 | 263 | 6/9/2024 |
| 3.0.0-dev-00171 | 233 | 6/9/2024 |
| 3.0.0-dev-00166 | 1,253 | 1/4/2024 |
| 3.0.0-dev-00161 | 638 | 12/23/2023 |