cCoder.Mail.Providers
2026.9.12.1300
dotnet add package cCoder.Mail.Providers --version 2026.9.12.1300
NuGet\Install-Package cCoder.Mail.Providers -Version 2026.9.12.1300
<PackageReference Include="cCoder.Mail.Providers" Version="2026.9.12.1300" />
<PackageVersion Include="cCoder.Mail.Providers" Version="2026.9.12.1300" />
<PackageReference Include="cCoder.Mail.Providers" />
paket add cCoder.Mail.Providers --version 2026.9.12.1300
#r "nuget: cCoder.Mail.Providers, 2026.9.12.1300"
#:package cCoder.Mail.Providers@2026.9.12.1300
#addin nuget:?package=cCoder.Mail.Providers&version=2026.9.12.1300
#tool nuget:?package=cCoder.Mail.Providers&version=2026.9.12.1300
cCoder.Mail
cCoder.Mail contains the Mail domain for the cCoder platform. It provides mail-server configuration, queued email, sent email, mailbox receive support, event handling, and the background sender loop used by cCoder applications.
View the latest main-branch code coverage report
Local Configuration
Each executable binds the complete configuration root to its own
AppConfiguration. The Web composition root registers CoreData, Mail,
SecurityData, Security, and Eventing side by side. The HostedServices
composition root registers CoreData, Mail, and Eventing.
Persistence belongs to the Data domains. MailConfiguration contains only
Mail behavior and provider availability; CoreData owns the database
connection, Data registration, and migrations. Likewise, SecurityData owns
the Security database and Security contains authentication behavior.
Functionality
- Mail server management: configure application-owned SMTP settings, including host, port, SSL, sender, and credentials.
- Queued email management: create and inspect pending outbound emails.
- Sent email management: inspect emails that have been successfully dispatched.
- Mail provider abstraction:
cCoder.Mail.Providerssupplies the SPAL factory and the SMTP, POP3, IMAP, and Microsoft Graph implementations. - Received email inspection:
ReceivedEmailControllercan fetch Microsoft 365 mailbox messages without persisting them. - Sender hosted service: checks the queue every minute and attempts SMTP delivery for pending messages.
- App lifecycle event handling: listens for app add, update, and delete events so mail-owned app data stays aligned.
- Manual test UI:
/tools/index.htmlprovides a lightweight CRUD surface for mail servers, queued mail, and sent mail, plus a received-mail tab for direct mailbox fetch testing. - Operational health:
Mail.WebreturnsOKfrom/Health.Mail.HostedServicesreturnsHealthyfrom/Healthand reports hosted services from/.
Contents
src/cCoder.MailThe main library package published to NuGet.src/cCoder.Mail.ProvidersThe provider abstraction, factory, and provider implementations.src/Mail.WebThe standalone web host for the Mail domain.src/Mail.HostedServicesThe hosted-services app for event listeners and the queued email sender.src/cCoder.Mail.TestsUnit tests for the domain.src/Mail.AcceptanceTestsAcceptance tests for the standalone web host.src/Mail.HostedServices.AcceptanceTestsAcceptance tests for the hosted-services app.src/Mail.IntegrationTestsEnd-to-end tests that send queued mail through Microsoft Graph and receive it back through Microsoft Graph.
Build
dotnet build src/cCoder.Mail.slnx -v minimal
Test
dotnet test src/cCoder.Mail.slnx -v minimal --no-build
The solution test run includes unit tests, app acceptance suites, and the mail delivery integration suite. Acceptance tests actively call the hosted HTTP surfaces, including health endpoints and the manual tools shell.
The end-to-end mail delivery test queues an email through Mail.Web, runs the sender orchestration, then calls the received-mail API until the same message is visible in the mailbox.
Run Locally
dotnet run --project src/Mail.Web/Mail.Web.csproj
dotnet run --project src/Mail.HostedServices/Mail.HostedServices.csproj
Useful Mail.Web endpoints:
/redirects to/tools/index.html./tools/index.htmlopens the manual domain tester./swaggeropens the API explorer./HealthreturnsOK./Api/Mail/ReceivedEmail/Receiveexposes the same receive endpoint on the Mail route.
Useful Mail.HostedServices endpoints:
/returns a plain-text hosted-services report./HealthreturnsHealthy.
Leave secrets empty in appsettings.json and define the base required values as
user-level or machine-level environment variables:
CoreData__ConnectionStringSecurityData__ConnectionString(Web only)Security__DecryptionKey(Web only)Eventing__ServiceBus__ConnectionStringwhenEventing__ProviderTypeisServiceBus
When Microsoft Graph is enabled, also define:
Mail__Providers__MicrosoftGraph__TenantIdMail__Providers__MicrosoftGraph__ClientIdMail__Providers__MicrosoftGraph__ClientSecret
CoreData__AdminConnectionString and
SecurityData__AdminConnectionString are optional migration-only overrides. If
an admin connection is configured, startup migrations use it and normal runtime
operations continue to use the regular connection. If it is omitted, migrations
use the regular connection.
Library consumers register persistence and behavior explicitly at their own
composition root: call AddData before AddMailWeb, AddMail, or
AddMailHostedServices; Web hosts also call AddSecurityData before
AddSecurityWeb. An application that consumes cCoder.Core should use Core's
composite API instead; Core deliberately composes its configured child domains
recursively.
Provider Configuration
Provider availability is expressed by entries in Mail:Providers. Omit a
provider to make it unavailable; there is no separate Enabled flag.
{
"Mail": {
"Providers": {
"Smtp": {},
"Pop3": {},
"Imap": {},
"MicrosoftGraph": {
"TenantId": "",
"ClientId": "",
"ClientSecret": ""
}
}
}
}
MailSender.ProviderName and MailReceiver.ProviderName select the client at
runtime. Their database records contain mailbox-specific host, port, user, and
password values. Platform-wide Graph application credentials remain in
configuration. Every provider implements IMailClient; invoking an unsupported
send or receive operation throws UnsupportedMailClientOperationException.
For SMTP delivery, Mail:Providers:Smtp must be present in configuration, the
application must have a valid MailSender row whose ProviderName is Smtp,
and that row must reference the required server/credential data. A queued email
is sent by the Mail hosted-services process, so configuring a sender row without
running that process does not dispatch queued messages. Microsoft Graph follows
the same database-row selection model, but its platform-wide tenant, client, and
client-secret values come from Mail:Providers:MicrosoftGraph.
Mail Delivery Integration
The real send-and-receive integration test requires these variables on the runner:
CoreData__ConnectionStringSecurityData__ConnectionStringSecurity__DecryptionKeyMail__Providers__MicrosoftGraph__TenantIdMail__Providers__MicrosoftGraph__ClientIdMail__Providers__MicrosoftGraph__ClientSecret
The test creates disposable integration databases by appending
-acceptance-{guid} to the configured Mail and Security database names.
It sends from SendUser to ReceiveUser, polls every 10 seconds for up to
120 seconds, and retrieves at most 50 messages.
The Graph application registration must have Mail.Send and Mail.Read application permissions with admin consent applied.
Package
The NuGet packages produced by this repository are:
cCoder.MailcCoder.Mail.Providers
Publishing
GitHub Actions is configured to publish the main package using NuGet trusted publishing.
Before the first publish, configure a trusted publishing policy on nuget.org for:
- Repository owner:
ccoder-co-uk - Repository:
cCoder.Mail - Workflow file:
publish.yml
The workflow also expects a NUGET_USER repository secret containing the nuget.org profile name used during trusted publishing login.
| 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
- cCoder.Data (>= 2026.8.28.1700)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on cCoder.Mail.Providers:
| Package | Downloads |
|---|---|
|
cCoder.Mail
cCoder.Mail |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2026.9.12.1300 | 57 | 9/12/2026 |
| 2026.9.9.833 | 122 | 9/9/2026 |
| 2026.8.28.2150 | 226 | 8/28/2026 |
| 2026.8.27.1754 | 123 | 8/27/2026 |
| 2026.8.26.2258 | 154 | 8/26/2026 |
| 2026.8.13.922 | 172 | 8/13/2026 |
| 2026.8.12.1401 | 129 | 8/12/2026 |
| 2026.8.10.1958 | 130 | 8/10/2026 |
| 2026.8.10.1409 | 104 | 8/10/2026 |
| 2026.8.8.2050 | 192 | 8/8/2026 |
| 2026.8.8.1740 | 108 | 8/8/2026 |
| 2026.8.5.128 | 223 | 8/5/2026 |
| 2026.8.4.2242 | 155 | 8/4/2026 |
| 2026.8.4.14 | 276 | 8/3/2026 |
| 2026.8.3.2105 | 109 | 8/3/2026 |
| 2026.8.3.1804 | 157 | 8/3/2026 |
| 2026.8.3.1737 | 119 | 8/3/2026 |
| 2026.8.2.1331 | 139 | 8/2/2026 |
| 2026.8.1.1515 | 234 | 8/1/2026 |
| 2026.7.30.1837 | 324 | 7/30/2026 |