IBeam.Communications.Email.Templating
2.7.0
See the version list below for details.
dotnet add package IBeam.Communications.Email.Templating --version 2.7.0
NuGet\Install-Package IBeam.Communications.Email.Templating -Version 2.7.0
<PackageReference Include="IBeam.Communications.Email.Templating" Version="2.7.0" />
<PackageVersion Include="IBeam.Communications.Email.Templating" Version="2.7.0" />
<PackageReference Include="IBeam.Communications.Email.Templating" />
paket add IBeam.Communications.Email.Templating --version 2.7.0
#r "nuget: IBeam.Communications.Email.Templating, 2.7.0"
#:package IBeam.Communications.Email.Templating@2.7.0
#addin nuget:?package=IBeam.Communications.Email.Templating&version=2.7.0
#tool nuget:?package=IBeam.Communications.Email.Templating&version=2.7.0
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}withmodel.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
- Project agent prompt:
.agent/prompt.md - Repository implementation guide:
../.agent/implementation-guide.md - Consuming API migration prompt:
../IBeam.AI.Enablement/examples/consuming-api-migration-prompt.md
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 | Versions 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. |
-
net10.0
- IBeam.Communications (>= 2.7.0)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.3)
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.8.0 | 0 | 7/21/2026 |
| 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 |