IBeam.Communications.Email.Templating 2.7.0

dotnet add package IBeam.Communications.Email.Templating --version 2.7.0
                    
NuGet\Install-Package IBeam.Communications.Email.Templating -Version 2.7.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="IBeam.Communications.Email.Templating" Version="2.7.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="IBeam.Communications.Email.Templating" Version="2.7.0" />
                    
Directory.Packages.props
<PackageReference Include="IBeam.Communications.Email.Templating" />
                    
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 IBeam.Communications.Email.Templating --version 2.7.0
                    
#r "nuget: IBeam.Communications.Email.Templating, 2.7.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 IBeam.Communications.Email.Templating@2.7.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=IBeam.Communications.Email.Templating&version=2.7.0
                    
Install as a Cake Addin
#tool nuget:?package=IBeam.Communications.Email.Templating&version=2.7.0
                    
Install as a Cake Tool

IBeam.Communications.Email.Templating

IBeam.Communications.Email.Templating adds file-based email template rendering and a templated email service on top of IBeam.Communications. It lets application services send named templates while staying on the provider-neutral IEmailService boundary.

When To Use This

  • You want email bodies to live in template files instead of service code.
  • You want the same template flow to work with SMTP, SendGrid, Azure Communication Services, or pickup-directory email.
  • You need simple token replacement for small templates.
  • You want an easy renderer to replace later with Razor, Liquid, Handlebars, or a database-backed template store.

What This Package Contains

Area Type(s) Purpose
Template renderer FileEmailTemplateRenderer Reads .html and .txt template files from a configured base path.
Templated email service TemplatedEmailService Renders a template and sends the resulting email through IEmailService.
Registration AddIBeamEmailTemplatingFromFiles(IConfiguration) Registers the file renderer and templated email service.
Shared contracts IEmailTemplateRenderer, ITemplatedEmailService, EmailTemplateOptions Provided by IBeam.Communications and implemented here.

Architecture Fit

This package is a service helper, not an API or repository package.

API <-- DTO/model object --> Service <-- Entity --> Repository

The consuming domain service decides why an email is sent. This package only handles how a named template becomes an email body and how that body is forwarded to the registered email provider.

Quick Start

Register base communications, an email provider, and file templating:

using IBeam.Communications.Abstractions;
using IBeam.Communications.Email.SendGrid;
using IBeam.Communications.Email.Templating;

builder.Services.AddIBeamCommunications(builder.Configuration);
builder.Services.AddIBeamSendGridEmail(builder.Configuration);
builder.Services.AddIBeamEmailTemplatingFromFiles(builder.Configuration);

Configuration:

{
  "IBeam": {
    "EmailTemplating": {
      "BasePath": "Templates/Email",
      "HtmlExtension": ".html",
      "TextExtension": ".txt"
    }
  }
}

Create template files:

Templates/Email/welcome.html
Templates/Email/welcome.txt

Use the templated service:

public sealed class WelcomeEmailService
{
    private readonly ITemplatedEmailService _templates;

    public WelcomeEmailService(ITemplatedEmailService templates)
    {
        _templates = templates;
    }

    public Task SendWelcomeAsync(string email, string displayName, CancellationToken ct = default)
        => _templates.SendTemplatedEmailAsync(
            [email],
            "Welcome",
            "welcome",
            displayName,
            ct: ct);
}

The file renderer performs simple replacement:

  • object[] models can fill {0}, {1}, and so on.
  • Any other model fills {0} with model.ToString().

Configuration

Setting Default Purpose
IBeam:EmailTemplating:BasePath required Directory containing template files.
IBeam:EmailTemplating:HtmlExtension .html Extension appended when looking for HTML templates.
IBeam:EmailTemplating:TextExtension .txt Extension appended when looking for text templates.

At least one matching template file must exist for the requested template name. If neither the HTML nor text file exists, the renderer throws EmailTemplateNotFoundException.

Service Operations, Auditing, And Permissions

This package does not own audit or permission decisions. Wrap the consuming service method that sends the templated email.

[IBeamOperation("accounts.invite")]
public Task InviteAsync(Guid tenantId, Guid userId, CancellationToken ct = default)
    => _operations.ExecuteAsync(
        this,
        token => InviteCoreAsync(tenantId, userId, token),
        new ServiceOperationExecutionOptions
        {
            TenantId = tenantId,
            EntityId = userId
        },
        ct);

private Task InviteCoreAsync(Guid tenantId, Guid userId, CancellationToken ct)
    => _templates.SendTemplatedEmailAsync(
        ["new.user@example.com"],
        "You have been invited",
        "tenant-invite",
        tenantId,
        ct: ct);

Do not tag TemplatedEmailService as if it were the business operation. Tag the domain operation that caused the email.

Data Storage

This package does not create database tables or Azure Table Storage schemas.

Storage Item Created By This Package Notes
Template files No The package reads template files from a path owned by the host app.
Email history/outbox No Add a consuming-service repository if durable tracking is required.
Azure Table Storage tables No No table schema is owned by this package.

Extension Points

Extension Point Interface Why Replace It
Template rendering IEmailTemplateRenderer Add a richer rendering engine, localization, database-backed templates, or theme selection.
Templated email flow ITemplatedEmailService Add tracking, tenant-specific template selection, or pre-send policies.
Delivery provider IEmailService Swap SMTP, SendGrid, Azure Communication Services, pickup directory, or a custom provider.

Package Relationships

Package Relationship
IBeam.Communications Owns the templating interfaces and shared options.
IBeam.Communications.Email.Templating Implements file-template rendering and render-plus-send orchestration.
Email provider packages Provide the IEmailService used after rendering.

Extended Examples And Agent Guidance

Troubleshooting

Problem Likely Cause Fix
EmailTemplateOptions.BasePath is not configured Missing IBeam:EmailTemplating:BasePath Add the base path to configuration.
EmailTemplateNotFoundException No .html or .txt file for the template name Add the template file or check the configured extensions.
Template name rejected Name contains invalid filename characters or .. Use a simple template key such as welcome or tenant-invite.
Render succeeds but send fails Email provider is missing or misconfigured Register and configure an IEmailService provider.

Version Notes

  • Targets net10.0.
  • Uses simple file rendering today; richer renderers should replace IEmailTemplateRenderer.
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
2.7.0 0 7/21/2026
2.6.0 29 7/20/2026
2.5.0 41 7/17/2026
2.4.2 48 7/16/2026
2.4.1 60 7/14/2026
2.4.0 102 6/24/2026
2.3.0 100 6/24/2026
2.2.0 110 6/23/2026
2.1.0 108 6/23/2026
2.0.68 103 6/23/2026
2.0.66 105 6/22/2026
2.0.65 104 6/22/2026
2.0.64 120 6/17/2026
2.0.63 108 6/16/2026
2.0.62 109 6/16/2026
2.0.57 122 6/8/2026
2.0.56 107 6/7/2026
2.0.54 230 5/27/2026
2.0.52 103 5/27/2026
2.0.35 105 5/15/2026
Loading failed