uTPro.Feature.MailHub 18.0.1

dotnet add package uTPro.Feature.MailHub --version 18.0.1
                    
NuGet\Install-Package uTPro.Feature.MailHub -Version 18.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="uTPro.Feature.MailHub" Version="18.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="uTPro.Feature.MailHub" Version="18.0.1" />
                    
Directory.Packages.props
<PackageReference Include="uTPro.Feature.MailHub" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add uTPro.Feature.MailHub --version 18.0.1
                    
#r "nuget: uTPro.Feature.MailHub, 18.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package uTPro.Feature.MailHub@18.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=uTPro.Feature.MailHub&version=18.0.1
                    
Install as a Cake Addin
#tool nuget:?package=uTPro.Feature.MailHub&version=18.0.1
                    
Install as a Cake Tool

uTPro Mail Hub

Umbraco 17 Umbraco 18 .NET 10 License: EULA

Lightweight, self-contained email delivery monitoring, audit history, and analytics dashboard for Umbraco 17 and 18. Transparently intercepts Umbraco's built-in IEmailSender via a fail-safe decorator so every transactional and system email (member invites, password resets, shop notifications, custom forms) is automatically tracked with zero host code changes.


1. Why Mail Hub?

Umbraco's built-in IEmailSender dispatches messages via SMTP but provides no delivery history, no failure diagnostics, no recipient analytics, and no backoffice visibility.

uTPro Mail Hub solves this by plugging seamlessly into the email pipeline:

  • Zero code changes: Automatically decorates IEmailSender. Any code calling _emailSender.SendAsync(...) is monitored automatically.
  • Fail-safe logging: Telemetry failures never interrupt or fail actual email dispatch.
  • Rich Backoffice Dashboard: Located under Settings → Mail Hub, presenting delivery volume trends, error spikes, success rates, recipient domain distribution, and full audit logs.
  • Search & Filter: Find emails by recipient, domain, subject, status, or date range.
  • Resend & Retention: Re-dispatch failed or previous emails with one click, and automatically purge expired logs.
  • Cross-Database: Auto-creates tables via NPoco migrations across SQL Server, SQLite, and PostgreSQL.

2. Installation

Install via NuGet:

dotnet add package uTPro.Feature.MailHub

The package self-wires during startup (IComposer). No changes to Program.cs or database connection strings are required.


3. Configuration

Mail Hub works out of the box with default settings. You can optionally customize behavior in appsettings.json:

{
  "uTPro": {
    "MailHub": {
      "Mode": "Log",
      "StoreBody": true,
      "RetentionDays": 30,
      "MaxRetry": 3,
      "RetryDelaySeconds": 60
    }
  }
}

Options Reference

Property Default Description
Mode "Log" Operating mode: "Log" (synchronous tracking) or "Queue" (queued background processing).
StoreBody true Whether to persist HTML/plain email body. Set false if emails contain strict confidential credentials.
RetentionDays 30 Number of days to retain logs before cleanup. Completed logs (Sent, Error) older than this threshold are purged. 0 disables cleanup.
MaxRetry 3 Maximum retry attempts for resending operations.
RetryDelaySeconds 60 Delay between successive retries.

4. Backoffice Dashboard

Navigate to Settings → Advanced Settings → Mail Hub in the Umbraco backoffice:

  1. Overview Dashboard:

    • KPI Summary: Total Delivered, Failed Deliveries, Success Rate %, and Volume in Selected Window (7 / 30 / 90 days).
    • Delivery Volume Trend: Interactive daily bar chart showing delivered vs failed counts.
    • Top Recipient Domains: Visual breakdown of destination domains (@gmail.com, @company.com) with percentage share.
    • Recent Activity: Quick access to recent outgoing emails with instant inspection.
  2. Email History:

    • Filter by keyword, subject, recipient, status, and email type.
    • Paged table with recipient, subject, type, status badge, and timestamp.
    • Email Audit Drawer: Inspect detailed metadata, header addresses (To, Cc, Bcc), formatted/raw HTML body preview, and complete error stack traces for failed deliveries.
    • Actions: One-click Resend Email or Delete Record.

5. Management API

Mail Hub exposes a versioned, authenticated Management API for the backoffice (gated behind the SectionAccessSettings authorization policy):

Method Endpoint Description
GET /umbraco/management/api/v1/utpro/mailhub/stats?days=30 Returns aggregated metrics, trends, and category distribution.
GET /umbraco/management/api/v1/utpro/mailhub/items Paged query for email logs with filtering parameters.
GET /umbraco/management/api/v1/utpro/mailhub/items/{id} Fetches full email audit details including body and error trace.
POST /umbraco/management/api/v1/utpro/mailhub/items/{id}/resend Re-sends the logged email via IEmailSender.
POST /umbraco/management/api/v1/utpro/mailhub/items/{id}/delete Deletes a single audit log record.
POST /umbraco/management/api/v1/utpro/mailhub/retention/cleanup Manually triggers purge of expired logs.

6. Architecture & Extensibility

                                  ┌───────────────────────────┐
                                  │   Application / Features  │
                                  │   (SimpleCart, Auth, etc) │
                                  └─────────────┬─────────────┘
                                                │ Calls IEmailSender
                                                ▼
┌────────────────────────────────────────────────────────────────────────────────────────┐
│ uTPro.Feature.MailHub                                                                  │
│                                                                                        │
│   ┌────────────────────────────────────────┐     Calls      ┌────────────────────────┐ │
│   │ MailHubEmailSender (Decorator)         ├───────────────►│ Inner IEmailSender     │ │
│   │ - Intercepts To/Cc/Subject/Body/Type   │                │ (Umbraco SMTP Core)    │ │
│   │ - Records start state                  │                └────────────────────────┘ │
│   │ - Records success / error trace        │                                           │
│   └───────────────────┬────────────────────┘                                           │
│                       │ Writes (isolated scope)                                        │
│                       ▼                                                                │
│   ┌────────────────────────────────────────┐     Reads      ┌────────────────────────┐ │
│   │ IMailHubRepository (NPoco)             │◄───────────────┤ Management API / Lit UI│ │
│   │ Table: uTProMailHubLog                 │                │ Settings -> Mail Hub   │ │
│   └────────────────────────────────────────┘                └────────────────────────┘ │
└────────────────────────────────────────────────────────────────────────────────────────┘
  • Decorator Registration: Registered via MailHubComposer with automatic discovery.
  • Fail-Safe Design: Log persistence runs within an isolated IServiceScope. If database connectivity fails, the outgoing email is still sent and the exception is logged to ILogger.
  • Database Migrations: Executed on application startup (UmbracoApplicationStartedNotification) using Umbraco's state-keyed MigrationPlan.

7. Building & Testing

Build the solution:

dotnet build uTPro.Feature.MailHub.sln

Run unit tests:

dotnet test tests/uTPro.Feature.MailHub.Tests/uTPro.Feature.MailHub.Tests.csproj

Package for both Umbraco 17 and 18:

pwsh ./pack.ps1

8. License

Licensed under the uTPro End User License Agreement. Copyright © 2025 T4VN. All rights reserved.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
18.0.1 70 11/18/2026
18.0.0 83 11/13/2026
17.0.1 64 11/18/2026
17.0.0 80 11/13/2026

v17.0.1 / v18.0.1: Add missing PackageIcon declaration so the NuGet gallery and Umbraco Marketplace display the correct icon. No functional, API, UI or database changes. v17.0.0 / v18.0.0: Initial release of uTPro Mail Hub. Provides transparent IEmailSender decorator logging, NPoco migrations, Management API, Lit backoffice dashboard in Settings, email history search, domain distribution analytics, resend action, and retention cleanup.