Cirreum.Communications.Email.Azure
1.1.1
dotnet add package Cirreum.Communications.Email.Azure --version 1.1.1
NuGet\Install-Package Cirreum.Communications.Email.Azure -Version 1.1.1
<PackageReference Include="Cirreum.Communications.Email.Azure" Version="1.1.1" />
<PackageVersion Include="Cirreum.Communications.Email.Azure" Version="1.1.1" />
<PackageReference Include="Cirreum.Communications.Email.Azure" />
paket add Cirreum.Communications.Email.Azure --version 1.1.1
#r "nuget: Cirreum.Communications.Email.Azure, 1.1.1"
#:package Cirreum.Communications.Email.Azure@1.1.1
#addin nuget:?package=Cirreum.Communications.Email.Azure&version=1.1.1
#tool nuget:?package=Cirreum.Communications.Email.Azure&version=1.1.1
Cirreum.Communications.Email.Azure
Azure Communication Services email functionality for the Cirreum communications framework. This implementation follows the Cirreum provider pattern, enabling seamless switching between email providers (SendGrid, Azure Communication Services, etc.) without code changes.
Features
- IEmailService Implementation: Drop-in replacement for any Cirreum email provider
- Single & Bulk Email Sending: Individual emails and parallel bulk operations with retry logic
- Flexible Authentication: Connection string (key-based) or Managed Identity authentication
- Async Operations: Built-in polling for Azure Communication Services operation status
- Health Checks: Service-level health monitoring using the same IEmailService interface
- Retry Logic: Exponential backoff with jitter for rate limits and transient failures
- Attachment Support: Inline and regular attachments with proper disposition handling
- Source-Generated Logging: High-performance logging optimized for .NET 10
- Configuration-Driven: Support for both manual registration and appsettings-based configuration
Installation
dotnet add package Cirreum.Communications.Email.Azure
Quick Start
Manual Registration
var builder = Host.CreateApplicationBuilder(args);
// Using connection string (key-based authentication)
builder.AddAzureEmailClient("primary", connectionJson, defaultFrom);
// Using endpoint (managed identity authentication)
builder.AddAzureEmailClient("primary",
endpoint: "https://myacs.communication.azure.com",
defaultFrom: new EmailAddress("noreply@company.com", "Company Name"));
var host = builder.Build();
Configuration-Based Registration (Recommended)
// Register the provider registrar
builder.AddServiceProvider<AzureEmailRegistrar>();
appsettings.json:
{
"EmailProviders": {
"Email.Azure": {
"Instances": {
"primary": {
"Name": "production",
"DefaultFrom": {
"Address": "noreply@company.com",
"Name": "Company Name"
},
"MaxRetries": 3,
"BulkOptions": {
"MaxConcurrency": 10,
"MaxBatchSize": 50
}
}
}
}
}
}
KeyVault (ConnectionStrings-production):
// Option 1: Key-based authentication
{
"ConnectionString": "endpoint=https://myacs.communication.azure.com/;accesskey=...",
"DefaultFrom": {
"Address": "noreply@company.com",
"Name": "Company Name"
}
}
// Option 2: Managed identity authentication
{
"Endpoint": "https://myacs.communication.azure.com",
"DefaultFrom": {
"Address": "support@company.com",
"Name": "Support Team"
}
}
// Option 3: Minimal (uses DefaultFrom from appsettings.json)
{
"ConnectionString": "endpoint=https://myacs.communication.azure.com/;accesskey=..."
}
Sending Emails
var emailService = serviceProvider.GetRequiredKeyedService<IEmailService>("primary");
// Single email
var result = await emailService.SendEmailAsync(new EmailMessage {
To = [new EmailAddress("user@example.com", "User Name")],
Subject = "Hello from Azure Communication Services",
HtmlContent = "<h1>Welcome!</h1><p>This email was sent via Azure Communication Services.</p>",
TextContent = "Welcome! This email was sent via Azure Communication Services."
});
// Bulk emails - shared template
var results = await emailService.SendBulkEmailAsync(
template: new EmailMessage {
Subject = "Monthly Newsletter",
HtmlContent = "<h1>Newsletter</h1>"
},
recipients: recipientList
);
// Bulk emails - fully personalized
var results = await emailService.SendBulkEmailAsync(personalizedMessages);
Authentication & Security
Authentication Methods
The service supports two authentication methods, controlled by what the security administrator provides in KeyVault:
Connection String (Key-Based): Traditional connection string with embedded access key
Identity-Based (Entra): Configure
Endpoint(without a connection string) and the provider authenticates with Entra. The nestedCredentialblock (shared across Cirreum providers) selects how:"Credential": { "Mode": "ManagedIdentity", "IdentityId": "<user-assigned-client-id>" }- Default —
DefaultAzureCredential;IdentityIdpins the chain's managed-identity leg - ManagedIdentity — deterministic
ManagedIdentityCredential; omitIdentityIdfor system-assigned - Developer — Visual Studio → Azure CLI → Azure PowerShell, as the signed-in developer
Identifiersets the Entra tenant for the tenant-aware credentials. Omitting the block entirely meansDefault. ACredentialblock alongside a key-based connection string fails at startup — identity configuration cannot apply to key authentication. The identity needs a data-plane RBAC role on the Communication Services resource.- Default —
Security Design
- SysAdmin Controls Authentication: Authentication method determined by what's provided in KeyVault
- DevOps Controls Configuration: Operational settings managed via appsettings.json
- Environment Separation: Different auth methods per environment (keys for dev, managed identity for prod)
Azure Communication Services Limitations
- Rate Limits: 30 emails/min, 100 emails/hour for free tier (higher quotas available)
- Recipients: Maximum 50 recipients per email (To + CC + BCC combined)
- Message Size: 10MB total including attachments (after Base64 encoding)
- Async Operations: All sends require polling for completion status
- Templates: No built-in template system (use external templating solutions)
Health Checks
Health checks use the same IEmailService interface and can optionally send test emails:
{
"HealthOptions": {
"SendTestEmail": true,
"TestEmailRecipient": "healthcheck@company.com",
"WaitForTestEmailCompletion": true,
"Timeout": "00:01:00"
}
}
Health checks automatically register when using the configuration-based approach.
Advanced Configuration
Bulk Operations
{
"BulkOptions": {
"MaxConcurrency": 10,
"MaxBatchSize": 50,
"BatchDelay": "00:00:01",
"WaitForCompletion": true,
"OperationTimeout": "00:05:00"
}
}
Global Headers and Tags
{
"GlobalHeaders": {
"X-Source": "MyApplication",
"X-Environment": "Production"
},
"GlobalTags": ["newsletter", "automated"]
}
Provider Pattern Benefits
- Vendor Independence: Switch between SendGrid, Azure, AWS SES with just configuration changes
- A/B Testing: Use different providers for different message types or user segments
- Multi-Tenant: Different providers per tenant or environment
- Gradual Migration: Migrate from one provider to another without code changes
Integration with the Runtime Extensions
This provider integrates seamlessly with Cirreum's communications runtime extensions:
// Single registration for all communication providers
builder.AddCommunications();
// Configuration determines what's actually available
var emailService = sp.GetKeyedService<IEmailService>("marketing"); // Could be SendGrid
var backupEmail = sp.GetKeyedService<IEmailService>("backup"); // Could be Azure
Dependencies
- .NET 10.0+
- Azure.Communication.Email 1.1.0
- Azure.Identity 1.14.1
- Cirreum.Communications.Email 1.0.108+
- Cirreum.ServiceProvider 1.0.5+
License
MIT License - see LICENSE file for details.
| 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
- Azure.Communication.Email (>= 1.1.0)
- Azure.Identity (>= 1.21.0)
- Cirreum.Communications.Email (>= 1.0.113)
- Cirreum.ServiceProvider (>= 1.1.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Cirreum.Communications.Email.Azure:
| Package | Downloads |
|---|---|
|
Cirreum.Runtime.Communications
The Runtime Communictions service configuration. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.1.1 | 45 | 8/4/2026 |
| 1.1.0 | 100 | 7/30/2026 |
| 1.0.20 | 105 | 7/20/2026 |
| 1.0.19 | 108 | 7/19/2026 |
| 1.0.18 | 139 | 7/4/2026 |
| 1.0.17 | 102 | 7/4/2026 |
| 1.0.16 | 129 | 5/7/2026 |
| 1.0.15 | 121 | 5/1/2026 |
| 1.0.14 | 127 | 4/28/2026 |
| 1.0.12 | 131 | 4/26/2026 |
| 1.0.11 | 138 | 4/14/2026 |
| 1.0.10 | 139 | 4/13/2026 |
| 1.0.9 | 142 | 4/10/2026 |
| 1.0.8 | 165 | 3/13/2026 |
| 1.0.7 | 127 | 3/12/2026 |
| 1.0.6 | 136 | 3/9/2026 |
| 1.0.5 | 131 | 3/6/2026 |
| 1.0.4 | 158 | 1/22/2026 |
| 1.0.3 | 137 | 1/21/2026 |
| 1.0.2 | 175 | 12/26/2025 |