Add the email need: each app gets its own sending-only mail account

needs = ["email"] (coreapp new --email) makes an LDAP account
coreapp-<name> (not a person, no mailbox) and adds SMTP_* settings.
Teardown removes it only if it's the app's; the installer warns about
an entry it left alone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-03 15:01:11 -07:00
co-authored by Claude Opus 5.5
parent bef3b86970
commit 6ab1db839b
12 changed files with 173 additions and 13 deletions
+24 -2
View File
@@ -67,7 +67,7 @@ image = "localhost/coreapp/my-app" # image name; the Core runs image:version
version = "0.1.0" # the image tag; raise it for each release
port = 8080 # the port the app serves HTTP on (any; 8080 is usual)
health = "/health" # a path that answers once it's up
needs = ["postgres", "sso"] # what it needs from the Core, or []
needs = ["postgres", "sso"] # what it needs from the Core, or [] ("email" too)
```
The installer is strict, because these values end up in files on the Core
@@ -147,9 +147,29 @@ has one: most self-hosted apps have "generic OIDC" settings that map onto
these variables. For a standard-library Python example of the whole flow,
`coreapp new --sso example` makes one (`oidc.py`).
### `email`: sending mail
The Core makes a mail account just for this app, for sending (no inbox),
and adds:
| Variable | Value |
|---|---|
| `SMTP_HOST` | `mail.<domain>` (the Core's mail server; valid certificate) |
| `SMTP_PORT` | `587` |
| `SMTP_SECURITY` | `starttls` (connect, then STARTTLS; not implicit TLS) |
| `SMTP_USER` | `coreapp-<name>` |
| `SMTP_PASSWORD` | random |
| `SMTP_FROM` | `<name>@<domain>`, the address to send from |
Most apps have SMTP settings; map these onto them. Mail to `SMTP_FROM`
isn't delivered anywhere (the account has no mailbox), so set a reply-to
if people should be able to answer. The account can't sign in to anything
else on the Core. `coreapp new --email` adds the need (there's no example
app for it).
### Not available yet
Email (sending mail through the Core), the Core's AI features (offering
The Core's AI features (offering
tools to its AI agent, or using its model), extra services such as Redis or
a second container, extra hostnames, and public ports other than HTTPS.
If the app can't work without one of these, say so plainly in your report
@@ -193,6 +213,8 @@ and make the Dockerfile fit the Core:
- **Keep state in `/data`**: point upload folders, SQLite files and
generated keys there. If the app needs a directory structure under `/data`,
create it at startup (it starts empty).
- **Send mail with `needs = ["email"]`**, if the app sends any (password
resets, notifications): map `SMTP_*` onto its mail settings.
- **Read settings from the environment**, mapping the Core's names to the
app's in an entrypoint script or config file if they differ
(`SECRET_KEY="$APP_SECRET"`, `DATABASE_URL=...`).