Improved and updated email notifications

Introducing the new Seq.App.Mail.* packages for SMTP and Microsoft365 email.

A lot has changed since the first email notification plugin was written for Seq! SMTP is alive and well, but .NET's SmtpClient is all but dead and gone. Services like Amazon SES and Microsoft 365 provide alternative email APIs alongside SMTP, with advantages for some, but with using different protocols and message formats.

The new Seq.App.Mail.* packages are our answer to these changes.

First, they're wholly modern codebases using MailKit on .NET 6+. Second, perhaps more importantly, they build on a general-purpose Seq.Mail package that provides functionality for constructing email messages from Seq events and alerts, independently from the delivery mechanism.

Dependency diagram showing Seq.Mail depending on Seq.Syntax. Three packages are shown depending on Seq.Mail: Seq.App.Mail.Smtp, Seq.App.Mail.Microsoft365, and a box with a horizontal ellipsis, indicating that custom email packages can be implemented in the same way.

This means that you can use Seq.Mail to easily build Seq plug-ins for whatever email delivery mechanism you need: the two we've shipped so far, for SMTP email and for Microsoft365, each require only a few dozen lines of code to implement.

Shown above alongside Seq.Mail is Seq.Syntax, this is also a new library, and it provides powerful text and HTML templating, using the same syntax as the Seq query language itself.

Important note: Seq.Mail isn't itself an app! You'll need to choose one of the concrete implementations - Seq.App.Mail.Smtp or Seq.App.Mail.Microsoft365 - to actually send email from your Seq server.

Seq.App.Mail.Smtp

This package replaces Seq.App.Email and Seq.App.EmailPlus. It supports a wide range of SMTP servers, using a range of connection security options.

Unlike the earlier packages, Seq.App.Mail.Smtp defaults to requiring TLS using the appropriate mechanism for the selected port, so make sure to choose a different setting if your mail server is unsecured or uses nonstandard ports.

Seq.App.Mail.Microsoft365

This package sends email using Microsoft's Azure-based email service.

To send mail using the Microsoft 365 app, you'll need to create an app registration in Azure. The app must have the Mail.Send permission for the Microsoft Graph API.

You can then configure Seq.App.Mail.Microsoft365 using your app's tenant id, client id, and client secret, as you would any other Azure-registered client app. Easy!

Learn more about the new mail apps and supporting packages in the project README.

Nicholas Blumhardt

Read more posts by this author.