![]() |
VOOZH | about |
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" />Directory.Packages.props
<PackageReference Include="Serilog.Sinks.Email" />Project file
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.1Install as a Cake Addin
#tool nuget:?package=Serilog.Sinks.Email&version=4.2.1Install as a Cake Tool
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.
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.
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 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 is compatible. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 is compatible. net463 net463 was computed. net47 net47 was computed. net471 net471 is compatible. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
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. |
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 | 51,030 | 4/30/2026 |
| 4.2.1-dev-02317 | 108 | 4/30/2026 |
| 4.2.1-dev-02316 | 101 | 4/30/2026 |
| 4.2.0 | 98,549 | 3/6/2026 |
| 4.2.0-dev-02315 | 99 | 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 | 138 | 3/6/2026 |
| 4.1.1-dev-02308 | 108 | 3/6/2026 |
| 4.1.0 | 702,234 | 4/19/2025 |
| 4.1.0-dev-02303 | 286 | 4/19/2025 |
| 4.1.0-dev-02301 | 563 | 4/8/2025 |
| 4.0.1-dev-00185 | 298 | 4/8/2025 |
| 4.0.0 | 987,834 | 6/9/2024 |
| 4.0.0-dev-00177 | 243 | 6/9/2024 |
| 3.0.0 | 280,679 | 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,255 | 1/4/2024 |
| 3.0.0-dev-00161 | 638 | 12/23/2023 |