diff --git a/aidlc-docs/features/identity-email-notifications/aidlc-state.md b/aidlc-docs/features/identity-email-notifications/aidlc-state.md
index 1c07e38..5dd9e35 100644
--- a/aidlc-docs/features/identity-email-notifications/aidlc-state.md
+++ b/aidlc-docs/features/identity-email-notifications/aidlc-state.md
@@ -5,7 +5,7 @@
- **Feature Slug**: identity-email-notifications
- **Project Type**: Brownfield
- **Start Date**: 2026-11-08
-- **Current Stage**: INCEPTION - design presented for approval (Workflow Planning, Application Design, Units); no code before approval
+- **Current Stage**: CONSTRUCTION - U1 mail-foundation code generated and tested (local commits, not pushed); requirements and design approved by Bryan (relayed), D1 and D2 decided
- **Branch**: feature/identity-email-notifications (branched from feature/andreaslop-site-hosting at e9feb37; own branch, not merged anywhere)
- **Request Type**: Feature (Bryan chose real e-mail over a workaround button; relayed by session "CMS & API")
@@ -42,6 +42,11 @@
- [x] Workspace Detection - Complete
- [x] Requirements Analysis - P1-P5 decided by Bryan (relayed); requirements.md updated
- [~] User Stories - skipped (see execution plan)
-- [x] Workflow Planning - written, approval pending
-- [x] Application Design - written, approval pending (choices D1, D2)
+- [x] Workflow Planning - approved (relayed)
+- [x] Application Design - approved (relayed); D1 picker in invite dialog, D2 stamp in access token (U3)
- [x] Units Generation - U1 mail-foundation, U2 identity-mail-flows, U3 password-reset
+
+### CONSTRUCTION
+- [x] U1 mail-foundation - Infrastructure Design (construction/mail-foundation/infrastructure-design/infrastructure-design.md), Code Generation done, build and tests green (see code-summary.md); hand-back pending
+- [ ] U2 identity-mail-flows
+- [ ] U3 password-reset (includes D2: security stamp in the access token)
diff --git a/aidlc-docs/features/identity-email-notifications/audit.md b/aidlc-docs/features/identity-email-notifications/audit.md
index 3880da3..3c6d090 100644
--- a/aidlc-docs/features/identity-email-notifications/audit.md
+++ b/aidlc-docs/features/identity-email-notifications/audit.md
@@ -57,3 +57,15 @@
**Context**: Inception documents complete; approval of requirements and design pending, no code.
---
+
+## Construction U1 - approval and code generation
+
+**Timestamp**: 2026-11-08T20:30:00Z
+
+**User Input**: "(Relayed by 'CMS & API', Bryan's decisions) Requirements + ontwerp identity-email-notifications: AKKOORD, begin met Code Generation van U1. D1: beheerder kiest nl/en in het uitnodigingsvenster (default sitetaal), bewaard op de uitnodiging, bij afronden overgenomen. D2: direct beeindigen: security stamp in access-token en vergelijken in de actief-controle (ook voor gewone wachtwoordwijziging); tokens van voor de deploy eenmalig geweigerd, refresh geeft stil een nieuw token. Test dit expliciet en meld het als gedragswijziging voor SLP Software. SMTP voor Infrastructure Design: Email__Smtp__Host=mail.slpsoftware.nl, Port=587, EnableSsl=true (STARTTLS). FromAddress/FromName ... no-reply@slpsoftware.nl. Let op SPF-aligned ... blijft productie-checklistpunt. ... Werk U1 op feature/identity-email-notifications, commit lokaal, geen push voordat U1 getest is; meld je na U1 met testresultaten en wat je op ASF test wilt uitrollen."
+
+**AI Response**: "Built U1 (Core email building blocks, SiteSettings store + migration, SiteSettings API, Mail card, capabilities flags, config sections, README). Tests: Core 452, Identity 96, Availability 82, Master 57, Offerings 57, ASF config 6, frontend 333; MariaDB-backed migration up/down/up and DateTimeOffset round trip verified against a real MariaDB container; vulnerability scan clean. D2 (stamp in access tokens) belongs to U3 and is recorded in the plan."
+
+**Context**: Construction U1, per-unit build and test done; completion message to follow via the peer session.
+
+---
diff --git a/aidlc-docs/features/identity-email-notifications/construction/mail-foundation/code/code-summary.md b/aidlc-docs/features/identity-email-notifications/construction/mail-foundation/code/code-summary.md
new file mode 100644
index 0000000..563fd5f
--- /dev/null
+++ b/aidlc-docs/features/identity-email-notifications/construction/mail-foundation/code/code-summary.md
@@ -0,0 +1,28 @@
+# Code summary - U1 mail-foundation
+
+## What was built
+**Core (`SlpModularCms.Core/Email`, `/SiteSettings`)**
+- `IEmailSender` (`SendAsync(OutgoingMail)` returning `MailSendResult`; SimpleDeckApp-shaped extension `SendAsync(to, subject, html)`), `SmtpEmailSender` (MailKit 4.18.2: StartTls when `EnableSsl`, authenticate only with a username, connect/send bounded by `TimeoutSeconds`, every exception mapped to `timeout|auth_failed|rejected|unknown`, exception type only in the log), `NullEmailSender` (`disabled`).
+- Headers are validated before connecting (`EmailAddressRules`: strict ASCII address allowlist, display name without control characters, colour `#rrggbb`); a bad value is refused with `rejected` and nothing is sent.
+- `EmailOptions` (section `Email`) and `AppMailOptions` (section `App`: `PublicBaseUrl`, `DefaultLanguage`), `EmailOptionsValidator` (start-up validation, only when `Email:Smtp:Host` is set; messages never contain credentials).
+- `MailTemplateRenderer` (six kinds, nl/en, one shared HTML layout with logo or site name, brand colour, button plus raw link, plain-text part; all values HTML-encoded; subject without control characters; unknown language falls back to Dutch), `LanguageResolver` (user, site default, Dutch).
+- `SiteSettingsEntity` + `ISiteSettingsService`/`SiteSettingsService` (sender address only from default + `Email:AllowedFromAddresses`, name 1..80 without control characters, blank = reset to defaults, a stored address that is no longer allowed falls back to the default on use). Table `SiteSettings` (migration `AddSiteSettings`, additive, with `Down`).
+- `AddCmsEmail` registration (null sender when mail is off), `SystemController` capabilities now include `EmailEnabled` and `DefaultLanguage`.
+
+**Identity module**: `SiteSettingsController` (`GET SiteSettings/mail` AdminOnly, `PUT SiteSettings/mail` OwnerOnly; 400 with code for invalid, 409 when mail is off).
+
+**Config**: `Email` and `App` sections (mail OFF, no credentials) in the ASF and SlpSoftware `appsettings.json`.
+
+**Frontend**: `MailSettingsCard` on the Settings page (only when `emailEnabled`; Owner edits, Administrator read-only; select limited to allowed addresses; restore defaults), `useMailSettings`, capabilities hook reads `emailEnabled`/`defaultLanguage`, nl/en strings.
+
+## Decisions kept from the design
+No mail configuration means no behaviour change anywhere. Sending never throws into callers. Sender address is never free text. Logo and colour come from per-site config (`Email:LogoUrl`, `Email:BrandColor`).
+
+## Tests
+- Core.Tests 452: option validation (every rule, no credentials in messages), address/name rules, renderer (nl/en, fallback, encoding, role names, no link without button, invalid colour), `SmtpEmailSender` against an in-process SMTP stub (success, sender override, SimpleDeckApp-shaped call, header injection refused without connecting, timeout, nothing listening, not configured, disabled), site settings (default, allowed, rejected, reset, narrowed allowlist, mail off), registration (null/SMTP sender, start-up failure), capabilities flag.
+- Property-based (PBT-03/07/08/09 partial): rendering never throws/never leaks raw markup/subject stays one line for any generated value; control characters never valid in a display name; only the allowed alphabet in addresses; sender never outside default + allowlist; token survives the link round trip (PBT-02).
+- MariaDB-backed (run when `ConnectionStrings__DefaultConnection` is set, as in CI; own scratch databases): all migrations apply on MariaDB, the newest is undone and re-applied; `DateTimeOffset` round trip.
+- Identity.Tests 96 (new `SiteSettingsControllerTests`: policies AdminOnly/OwnerOnly, status mapping). Frontend 333 (card: hidden when off, Owner saves, allowed options only, save disabled/empty/too-long name, reset, Administrator read-only; capabilities flags). ESLint and tsc clean. `dotnet list package --vulnerable` clean.
+
+## Not run locally
+`Api.Tests` and the ASF `HostPipelineTests` (the developer's `appsettings.local.json` overrides the connection string and points to a database that is not running); CI runs them. The new migration was verified separately on a real MariaDB (above).
diff --git a/aidlc-docs/features/identity-email-notifications/construction/mail-foundation/infrastructure-design/infrastructure-design.md b/aidlc-docs/features/identity-email-notifications/construction/mail-foundation/infrastructure-design/infrastructure-design.md
new file mode 100644
index 0000000..b4a75d7
--- /dev/null
+++ b/aidlc-docs/features/identity-email-notifications/construction/mail-foundation/infrastructure-design/infrastructure-design.md
@@ -0,0 +1,34 @@
+# Infrastructure design - U1 mail-foundation
+
+## Configuration keys (per environment, on the host)
+| Key | Where | Example / note |
+|---|---|---|
+| `Email__Smtp__Host` | `shared/env` | `mail.slpsoftware.nl` (the SMTP host SimpleDeckApp uses in production, per Bryan). Setting it switches mail ON. |
+| `Email__Smtp__Port` | `shared/env` | `587` |
+| `Email__Smtp__EnableSsl` | `shared/env` | `true` (STARTTLS) |
+| `Email__Smtp__Username`, `Email__Smtp__Password` | `shared/env` (mode 600) | secrets, never committed, never in messages or logs |
+| `App__PublicBaseUrl` | `shared/env` | `https://test.andreaslop.nl` (https, no path) |
+| `App__DefaultLanguage` | optional | `nl` (default) or `en` |
+| `Email__FromAddress`, `Email__FromName` | committed default or env | `no-reply@slpsoftware.nl` / site name (SimpleDeckApp's committed default) |
+| `Email__AllowedFromAddresses__0..n` | env | extra sender addresses a site may choose in its settings; empty = only `FromAddress` |
+| `Email__LogoUrl`, `Email__BrandColor` | committed (ASF) or env | `/admin/brand-logo-on-light.png`, `#5f6a58` |
+
+Start-up validation refuses a broken mail configuration (when a host is set) with a message that never contains the credentials. Without a host nothing changes.
+
+## Local development
+smtp4dev (already installed) on `localhost:25`: `Email__Smtp__Host=localhost`, `Email__Smtp__Port=25`, `Email__Smtp__EnableSsl=false`, no username, `App__PublicBaseUrl=http://localhost:5200` (http is accepted for loopback only).
+
+## ASF test host (Operations will do it, needs Bryan's go for the real test mail)
+1. Add the keys above to `shared/env` of `andreaslopfotografie-test` (mode 600 stays), restart the unit.
+2. `Email__FromAddress` stays `no-reply@slpsoftware.nl` (the SMTP service's own domain). A sender on `@andreaslop.nl` only after the check below.
+3. One real test mail to an address of Bryan before approval.
+
+## Sender-domain alignment (production checklist item)
+`From:` domain, SPF and DKIM must agree with the SMTP service that actually sends:
+- SPF of the `From:` domain must authorise the sending service (today both `slpsoftware.nl` and `andreaslop.nl` publish `v=spf1 a mx include:smtp.spf.ziggo.nl ~all`).
+- That service must DKIM-sign for the `From:` domain (a `dkim._domainkey` record exists for both domains; whether the service signs with it is not visible from outside).
+- `mail.slpsoftware.nl` will deliver `@andreaslop.nl` mail properly only if it may send/sign for that domain. DMARC is `p=none` today (monitoring only).
+- Therefore the sender list is an allowlist: add an `@andreaslop.nl` address to `Email__AllowedFromAddresses` only after this is confirmed.
+
+## No other infrastructure
+No new service, port, queue or storage. One additive table (`SiteSettings`) in the existing database.
diff --git a/frontend/src/features/settings/components/MailSettingsCard.test.tsx b/frontend/src/features/settings/components/MailSettingsCard.test.tsx
new file mode 100644
index 0000000..0e5bf4a
--- /dev/null
+++ b/frontend/src/features/settings/components/MailSettingsCard.test.tsx
@@ -0,0 +1,111 @@
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+import { screen } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
+import { http, HttpResponse } from 'msw';
+import { renderApp, mockAuthenticated } from '@/test/utils';
+import { server } from '@/mocks/server';
+import { API_BASE, makeAuthResponse, mockUser } from '@/features/auth/mocks/fixtures';
+import { _resetSetupStatusCache } from '@/router';
+import type { MailSettings } from '@/features/settings/services/types';
+
+beforeEach(() => {
+ _resetSetupStatusCache();
+});
+
+const baseSettings: MailSettings = {
+ emailEnabled: true,
+ fromAddress: 'no-reply@slpsoftware.nl',
+ fromName: 'Andrea Slop Fotografie',
+ defaultFromAddress: 'no-reply@slpsoftware.nl',
+ defaultFromName: 'Andrea Slop Fotografie',
+ allowedFromAddresses: ['no-reply@slpsoftware.nl', 'info@andreaslop.nl'],
+ isCustomized: false,
+};
+
+function mailEnabled(settings: MailSettings = baseSettings, put?: (body: unknown) => void) {
+ server.use(
+ http.get('*/System/capabilities', () =>
+ HttpResponse.json({ modules: ['Availability', 'Identity'], emailEnabled: true, defaultLanguage: 'nl' }),
+ ),
+ http.get(`${API_BASE}/api/v1/SiteSettings/mail`, () => HttpResponse.json(settings)),
+ http.put(`${API_BASE}/api/v1/SiteSettings/mail`, async ({ request }) => {
+ const body = await request.json();
+ put?.(body);
+ return HttpResponse.json({ ...settings, isCustomized: true });
+ }),
+ );
+}
+
+function asAdministrator() {
+ server.use(
+ http.post(`${API_BASE}/api/v1/auth/refresh`, () =>
+ HttpResponse.json(makeAuthResponse({ user: { ...mockUser, role: 'Administrator', name: 'Test Admin' } })),
+ ),
+ );
+}
+
+describe('MailSettingsCard', () => {
+ it('is not shown when the site cannot send mail', async () => {
+ mockAuthenticated();
+ renderApp('/settings');
+
+ await screen.findByTestId('settings-title', {}, { timeout: 10000 });
+ expect(screen.queryByTestId('mail-settings-card')).not.toBeInTheDocument();
+ });
+
+ it('lets the Owner pick an allowed sender and name, and saves them', async () => {
+ mockAuthenticated();
+ let saved: unknown;
+ mailEnabled(baseSettings, (b) => (saved = b));
+ renderApp('/settings');
+
+ const select = await screen.findByTestId('mail-from-address', {}, { timeout: 10000 });
+ expect(Array.from((select as HTMLSelectElement).options).map((o) => o.value)).toEqual([
+ 'no-reply@slpsoftware.nl',
+ 'info@andreaslop.nl',
+ ]);
+ await userEvent.selectOptions(select, 'info@andreaslop.nl');
+ const name = screen.getByTestId('mail-from-name');
+ await userEvent.clear(name);
+ await userEvent.type(name, 'Andrea');
+ await userEvent.click(screen.getByTestId('mail-save-button'));
+
+ await vi.waitFor(() => expect(saved).toEqual({ fromAddress: 'info@andreaslop.nl', fromName: 'Andrea' }));
+ });
+
+ it('disables save until something changes, and blocks an empty or too long name', async () => {
+ mockAuthenticated();
+ mailEnabled();
+ renderApp('/settings');
+
+ const save = await screen.findByTestId('mail-save-button', {}, { timeout: 10000 });
+ expect(save).toBeDisabled();
+
+ const name = screen.getByTestId('mail-from-name');
+ await userEvent.clear(name);
+ expect(save).toBeDisabled();
+
+ await userEvent.type(name, 'x'.repeat(81));
+ expect(screen.getByTestId('mail-from-name-error')).toBeInTheDocument();
+ expect(save).toBeDisabled();
+ });
+
+ it('offers to restore the defaults only once the sender was customised', async () => {
+ mockAuthenticated();
+ mailEnabled({ ...baseSettings, isCustomized: true });
+ renderApp('/settings');
+
+ expect(await screen.findByTestId('mail-reset-button', {}, { timeout: 10000 })).toBeEnabled();
+ });
+
+ it('shows an Administrator the settings read-only', async () => {
+ asAdministrator();
+ mailEnabled();
+ renderApp('/settings');
+
+ expect(await screen.findByTestId('mail-from-address', {}, { timeout: 10000 })).toBeDisabled();
+ expect(screen.getByTestId('mail-from-name')).toBeDisabled();
+ expect(screen.getByTestId('mail-readonly-note')).toBeInTheDocument();
+ expect(screen.queryByTestId('mail-save-button')).not.toBeInTheDocument();
+ });
+});
diff --git a/frontend/src/features/settings/components/MailSettingsCard.tsx b/frontend/src/features/settings/components/MailSettingsCard.tsx
new file mode 100644
index 0000000..6d12d83
--- /dev/null
+++ b/frontend/src/features/settings/components/MailSettingsCard.tsx
@@ -0,0 +1,120 @@
+import { useState } from 'react';
+import { useTranslation } from 'react-i18next';
+import { toast } from 'sonner';
+import { Button } from '@/components/ui/button';
+import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
+import { Input } from '@/components/ui/input';
+import { Label } from '@/components/ui/label';
+import { useAuth } from '@/features/auth/context/auth-context';
+import { ProblemDetailsError } from '@/lib/api-client';
+import { useMailSettings, useUpdateMailSettings } from '@/features/settings/services/useMailSettings';
+import type { MailSettings } from '@/features/settings/services/types';
+
+const MAX_NAME_LENGTH = 80;
+
+/** Sender of the site's mails. An Administrator sees it, only an Owner changes it. */
+export function MailSettingsCard({ emailEnabled }: { emailEnabled: boolean }) {
+ const { t } = useTranslation();
+ const { user } = useAuth();
+ const { data } = useMailSettings(emailEnabled);
+
+ // The card exists only where mail is configured: without it nothing here would do anything.
+ if (!emailEnabled || !data) return null;
+
+ // Keyed by the stored values so a saved change re-initialises the form from the server's answer.
+ return ;
+}
+
+function MailSettingsForm({ data, canEdit, t }: { data: MailSettings; canEdit: boolean; t: (key: string) => string }) {
+ const update = useUpdateMailSettings();
+ const [address, setAddress] = useState(data.fromAddress);
+ const [name, setName] = useState(data.fromName);
+
+ const nameTooLong = name.trim().length > MAX_NAME_LENGTH;
+ const nameEmpty = name.trim().length === 0;
+ const unchanged = address === data.fromAddress && name.trim() === data.fromName;
+
+ const save = async (payload: { fromAddress: string | null; fromName: string | null }, successKey: string) => {
+ try {
+ await update.mutateAsync(payload);
+ toast.success(t(successKey));
+ } catch (err) {
+ if (err instanceof ProblemDetailsError || (err as { status?: number }).status === 400) {
+ toast.error(t('settings.mail.invalid'));
+ } else {
+ toast.error(t('errors.generic'));
+ }
+ }
+ };
+
+ return (
+
+
+ {t('settings.mail.title')}
+
+
+