Documentation
DocumentationDiscussions
Documentation
These docs are for v2. Click to read the latest docs for v2024.3.

Formatting HTML Email

Seq can automatically send email when events are logged – this is accomplished using the Email+ app Seq.App.EmailPlus, which you can install directly from NuGet by following the instructions here.

The Default Template

Once the app is installed and an instance configured, you're all set to send email: the app comes with a simple template out of the box that turns this event:

1532

Into an HTML email like this:

1644

The template will show the details of the event including its timestamp, level, message and properties.

Linking Back to your Seq Server

The email sent by Seq includes a link back to view the event on the Seq server. This uses the address on which Seq is configured to listen - http://localhost:5341 by default.

To set a different hostname, configure your Seq instance to listen at a specific URL.

Writing Handlebars Templates

If you would like to send email with a different body, you can provide an HTML template using Handlebars syntax.

📘

Looking for an example?

The default template itself is published on GitHub for you to read and modify. Mail clients tend to have very patchy support for CSS. Once you've made changes and confirmed them in a browser, you'll need to run the HTML through a CSS inliner before pasting it into Seq.

To include a property like CartSize in the event, simply include it in double-braces:

<p>A new sale was processed for {{CartSize}} items.</p>

Built-in Properties

In addition to the properties from the event payload, a number of built-in properties provide access to the event's metadata. These are prefixed with a dollar sign and include:

Name

Description

$EventType

The type assigned to the event, for example $00COFFEE

$Exception

The full text of the exception attached to the event, if any, including stack trace

$Id

The event's id, for example event-1234...abcd

$Level

Verbose, Debug, Warning, Error, or Fatal

$LocalTimestamp

The local timestamp attached to the event including timezone offset

$Instance

The instance name of the Seq server sending the email, if any

$Message

The rendered message text for the event

$MessageTemplate

The message template for the event

$Properties

A list of Name/Value pairs describing the event's properties; see below

$ServerUrl

The Seq server's listening URL

$UtcTimestamp

The UTC timestamp of the event

Enumerating event properties

To list properties attached to the event, use the Handlebars each construct. Property objects have a name and a value; there's a built-in helper called "pretty" that can format complex objects if necessary.

<ul>
  {{#each $Properties}}
  <li>{{Name}} is {{pretty Value}}</li>
  {{/each}}
</u>