feat: add email-api service and email-api-models contract project

New internal service that centralises SMTP email sending.
- email-api-models: SendEmailRequest DTO, IEmailApiClient Refit interface, EmailApiSettings
- email-api: SmtpEmailDispatcher (MailKit), EmailController (POST /api/email/send),
  branded HTML shell wrapper, shared-Files-volume attachment support
- Protected by X-Internal-Api-Key via UseInternalApiKeyProtection()
- No exposed Docker port — internal network only (http://email-api:8080)

Closes #22

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-27 16:15:59 +03:00
parent 45d991ab5b
commit 26b13f6dbf
10 changed files with 326 additions and 0 deletions
@@ -0,0 +1,10 @@
using EmailApi.Models.Requests;
using Refit;
namespace EmailApi.Models.Clients;
public interface IEmailApiClient
{
[Post("/api/email/send")]
Task SendAsync(SendEmailRequest request, CancellationToken ct = default);
}
@@ -0,0 +1,10 @@
namespace EmailApi.Models.Requests;
public sealed class SendEmailRequest
{
public required List<string> To { get; init; }
public string? ReplyTo { get; init; }
public required string Subject { get; init; }
public required string HtmlBody { get; init; }
public string? AttachmentPath { get; init; }
}
@@ -0,0 +1,7 @@
namespace EmailApi.Models.Settings;
public sealed class EmailApiSettings
{
public string BaseUrl { get; set; } = "";
public string InternalApiKey { get; set; } = "";
}
@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<AssemblyName>email-api-models</AssemblyName>
<RootNamespace>EmailApi.Models</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Refit.HttpClientFactory" />
</ItemGroup>
</Project>