Sends email notifications for new clients using MailKit, configurable via app settings.
// Source: https://github.com/Byggarepop/TokenSaver | License: MIT | Copyright 2026 Byggarepop
// Provided via justclaw.it.com; keep this notice with the code.
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
using MailKit.Net.Smtp;
using MailKit.Security;
using MimeKit;
namespace TokenSaverViewer;
public sealed class EmailNotificationService
{
private readonly IConfiguration _config;
private readonly ILogger<EmailNotificationService> _logger;
public EmailNotificationService(IConfiguration config, ILogger<EmailNotificationService> logger)
{
_config = config;
_logger = logger;
}
public async Task SendNewClientNotificationAsync(string clientId)
{
var host = _config["Email:SmtpHost"];
var portStr =
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key