DigitalWonderlab.MultiDomainEmail 2.2.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package DigitalWonderlab.MultiDomainEmail --version 2.2.0
                    
NuGet\Install-Package DigitalWonderlab.MultiDomainEmail -Version 2.2.0
                    
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="DigitalWonderlab.MultiDomainEmail" Version="2.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DigitalWonderlab.MultiDomainEmail" Version="2.2.0" />
                    
Directory.Packages.props
<PackageReference Include="DigitalWonderlab.MultiDomainEmail" />
                    
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 DigitalWonderlab.MultiDomainEmail --version 2.2.0
                    
#r "nuget: DigitalWonderlab.MultiDomainEmail, 2.2.0"
                    
#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 DigitalWonderlab.MultiDomainEmail@2.2.0
                    
#: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=DigitalWonderlab.MultiDomainEmail&version=2.2.0
                    
Install as a Cake Addin
#tool nuget:?package=DigitalWonderlab.MultiDomainEmail&version=2.2.0
                    
Install as a Cake Tool

Multi-Domain Email & Forms for Umbraco

Multi-domain SMTP and reCAPTCHA support for Umbraco Forms. Perfect for multi-site installations where each domain needs its own email settings and reCAPTCHA keys.

Features

  • Multi-Domain SMTP - Different email settings per domain
  • Multi-Domain reCAPTCHA - Separate reCAPTCHA keys per domain
  • Forms Workflow - Pre-built Umbraco Forms workflow
  • Automatic Detection - Detects current domain automatically
  • Fallback Support - Falls back to default config when needed

Installation

.NET CLI

dotnet add package DigitalWonderlab.MultiDomainEmail

Package Manager Console

NuGet\Install-Package DigitalWonderlab.MultiDomainEmail

Requirements

  • Umbraco CMS 13-16+
  • Umbraco Forms 13-16+
  • .NET 8.0 (v13-14) or .NET 9.0 (v15-16+)

Configuration

Add to your appsettings.json:

{
  "MultiDomainSmtpSettings": {
    "example.com": {
      "From": "noreply@example.com",
      "Host": "smtp.mailgun.org",
      "Port": 587,
      "Username": "postmaster@mg.example.com",
      "Password": "your-password-here",
      "SecureSocketOptions": "StartTls"
    },
    "anotherdomain.com": {
      "From": "info@anotherdomain.com",
      "Host": "smtp.sendgrid.net",
      "Port": 587,
      "Username": "apikey",
      "Password": "your-api-key",
      "SecureSocketOptions": "Auto"
    },
    "default": {
      "From": "noreply@yourdefault.com",
      "Host": "smtp.gmail.com",
      "Port": 587,
      "Username": "your-email@gmail.com",
      "Password": "your-password",
      "SecureSocketOptions": "StartTls"
    }
  },
  "MultiDomainRecaptcha": {
    "example.com": {
      "SiteKey": "6Lc-your-site-key",
      "PrivateKey": "6Lc-your-private-key"
    },
    "anotherdomain.com": {
      "SiteKey": "6Lc-different-site-key",
      "PrivateKey": "6Lc-different-private-key"
    },
    "default": {
      "SiteKey": "6Lc-default-site-key",
      "PrivateKey": "6Lc-default-private-key"
    }
  }
}

Usage

Using the Umbraco Forms Workflow

  1. Create or edit a form in Umbraco backoffice
  2. Add the "Multi-Domain Email" workflow
  3. Configure settings:
    • Email - Recipient email address
    • Subject - Email subject line
    • Show All Form Fields - Include all fields (checkbox)
    • Custom Message - Optional message
    • Send Copy To Submitter - Send confirmation email (checkbox)
    • Submitter Email Field - Field alias for submitter's email

The workflow automatically uses the correct SMTP settings for the current domain.

Using Multi-Domain reCAPTCHA

To use reCAPTCHA v3 with Umbraco Forms across multiple domains:

  1. Configure your reCAPTCHA keys in appsettings.json (see Configuration section above)
  2. Add a reCAPTCHA field to your Umbraco Form:
    • In the form designer, add a new field
    • Choose "Recaptcha 3" as the field type
  3. The package automatically handles the rest - each domain will use its own reCAPTCHA keys

Note: The reCAPTCHA configuration only affects Umbraco Forms' built-in reCAPTCHA v3 fields. Custom reCAPTCHA implementations are not affected.

Token Replacement

Use these tokens in subject or custom message:

  • {fieldName} - Any form field (e.g., {Name}, {Email})
  • {formName} - Form name
  • {submissionDate} - Submission date/time

Example:

Hello {Name}, thank you for contacting us on {submissionDate}.

How It Works

Domain Detection

  • Extracts domain from current HTTP request
  • Automatically strips port numbers - localhost:44322 → localhost
  • Removes www. prefix - www.example.com → example.com
  • Case-insensitive matching - Example.COM matches example.com config
  • Works seamlessly across all environments (localhost, staging, production)

Important: Configure domains without port numbers in your appsettings.json:

  • ✅ Correct: "localhost"
  • ❌ Incorrect: "localhost:44322"
  • ✅ Correct: "example.com"
  • ❌ Incorrect: "example.com:443"

The package automatically handles all ports for each domain, so one config entry works everywhere.

Configuration Fallback

The system follows this priority order when looking for SMTP settings:

  1. Domain-specific config - Exact match (e.g., example.com)
  2. default config - Fallback for unmatched domains
  3. Legacy SmtpSettings - Umbraco's standard SMTP config (SMTP only, not reCAPTCHA)

Email Template System

Automatic Template Extraction: On first startup, the package extracts customizable email templates to:

~/Views/Partials/Forms/EmailTemplates/
├── AdminNotification.cshtml       (Admin notification emails)
├── SubmitterConfirmation.cshtml   (Thank you emails to submitters)
└── README.txt

How It Works:

  • Custom templates first - If .cshtml files exist, they're used
  • Fallback protection - Built-in templates used if custom ones are missing or fail
  • Preserved on updates - Your customizations won't be overwritten
  • Easy customization - Edit the .cshtml files directly, changes apply immediately

Two Email Types:

  1. Admin Notification (AdminNotification.cshtml) - Always sent to the configured email address
  2. Submitter Confirmation (SubmitterConfirmation.cshtml) - Optional "thank you" email sent when "Send Copy To Submitter" is enabled

Local Development

For local testing with email capture tools like MailHog or Papercut SMTP:

  • Use localhost (without port) in your configuration
  • Works with any local port: :5000, :44322, :3000, etc.
  • No need to configure multiple entries for different ports

Security

Never commit passwords! Use environment variables or secrets:

# User secrets (development)
dotnet user-secrets set "MultiDomainSmtpSettings:example.com:Password" "your-password"

# Environment variables (production)
export MultiDomainSmtpSettings__example_com__Password="your-password"

Support


Made by Digital Wonderlab

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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
2.3.2 171 4/10/2026
2.3.1 148 1/5/2026
2.2.0 231 10/22/2025
Loading failed