# v366 - CORI Mail custom domain and storage readiness

> **Superseded placement note added in v391:** v366 is preserved as historical context, but its visible SMTP credential panel inside `/cori/mail` was superseded by v369, v372, and v389. SMTP/provider setup belongs in `/company/integrations`; CORI Mail remains for briefing, drafting, review, work cards, and final approval.

## Purpose

v366 continues the CORI Mail track after v365. The goal is to make CORI Mail ready for real provider connection work while keeping the user interface simple, safe, and easy for dispatch users.

## Decision

Continue deepening CORI Mail before moving to another CORI-first surface.

Email is a core trucking work channel. Brokers, shippers, dispatchers, drivers, accounting teams, and paperwork teams all use email. CORI Mail should become a plain-language operating surface where users do not have to hunt through an inbox or decide what to say from scratch.

## What changed

- Added custom domain email as a third CORI Mail connection path beside Gmail and Outlook.
- Added a visible **Add SMTP credentials** panel inside `/cori/mail`.
- The SMTP panel supports:
  - from email
  - display name
  - SMTP host
  - SMTP port
  - SMTP username
  - app password
  - STARTTLS or SSL/TLS
  - IMAP host for future inbox reading
- Added safe SMTP staging behavior.
- The page does **not** save real passwords in browser memory.
- Added persistent memory guidance for:
  - drafts
  - email-to-work cards
  - provider tokens
  - send history
- Expanded provider readiness to include:
  - Gmail OAuth
  - Outlook OAuth
  - Custom Domain SMTP
  - encrypted secret vault readiness
  - persistent draft/action storage planning
- Added custom-domain CORI Mail environment placeholders to `.env.example`.

## Important safety rule

CORI may draft, explain, stage, and prepare email actions. CORI must not send a real email until the user approves the final message.

SMTP passwords, OAuth tokens, and provider secrets must be stored only in encrypted server-side storage. They must not be stored in browser localStorage.

## Simple user-facing wording standard

Use simple words:

- Add SMTP credentials
- From email
- App password
- Test setup
- Stage safe save
- Encrypted server save next

Avoid confusing words on the user-facing page unless they are required by the email provider.

## Prisma schema impact

No Prisma schema changes were made in v366.

Persistent provider accounts, encrypted SMTP credentials, provider tokens, drafts, work actions, and send audit records should be added in a later schema-backed build.
