Skip to content

ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.

Finalize Connections hub: complete #8 SMTP relay docs + lint cleanup

Juan Denis7b6086934dce
diff --git a/docs/CONNECTIONS_ROADMAP.md b/docs/CONNECTIONS_ROADMAP.md
index 732e4549..32c8d5a4 100644
--- a/docs/CONNECTIONS_ROADMAP.md
+++ b/docs/CONNECTIONS_ROADMAP.md
@@ -31,12 +31,12 @@ Three consequences fall out of that table:
Built in one session and verified — `npm run build` (frontend, clean), `eslint` (clean), `py_compile` + venv import (backend, clean). Runtime click-through with real provider credentials is still the operator's to do.
- **Phase 1 — surface what exists:** #2 Infrastructure category (DigitalOcean / Hetzner / Vultr / Linode → existing `/cloud`), #3 S3 + Backblaze B2 storage cards (→ existing `/backups/storage`), #4 cross-links on every connected card ("N servers — Servers →", "N domains — Domains →", bucket → Backups, "New service →").
-- **Phase 2 — complete the tiles:** #5 GitLab source (full OAuth mirror of GitHub, 9 routes), #6 DigitalOcean DNS, #7 GoDaddy DNS (both as new dispatch branches in `dns_provider_service.py`). **#8 SMTP relay — not built**; it needs mail-server outbound-relay wiring (a separate subsystem), so it stays a "coming soon" tile.
+- **Phase 2 — complete the tiles:** #5 GitLab source (full OAuth mirror of GitHub, 9 routes), #6 DigitalOcean DNS, #7 GoDaddy DNS (both as new dispatch branches in `dns_provider_service.py`), **#8 SMTP relay** — a real Postfix smarthost (`relayhost` + SASL `sasl_passwd`) with an OS-agnostic `smtplib` connection test; new `EmailRelayConfig` model (password Fernet-encrypted) + `/email/relay` routes + a presets-driven modal (Postmark / SES / Mailgun / SendGrid / custom). All four "coming soon" tiles are now live.
- **Phase 3 — domain ownership & expiry:** #9 `RegistrarConnection` model (**Fernet-encrypted** from the start), #10 `RegistrarService` (GoDaddy portfolio + expiry), #11 *not needed as written* — expiry is sourced **live** from the registrar, so no `domains`-table migration was required, #12 the `RegistrarPortfolio` panel on the Domains page ("N days left", colour-coded by urgency, Sync button), #13 registrar card shows "N domains · M expiring ≤30d". **Namecheap** intentionally left "coming soon" (XML API + IP allow-listing).
New backend: `models/registrar_connection.py`, `services/registrar_service.py`, `api/registrars.py` (`/api/v1/registrars`, registered). New/changed frontend: expanded `providerCatalog.js` (6 categories, 16 tiles), rebuilt `ConnectProviderModal.jsx` (5 provider kinds), `ConnectionsHub.jsx`, `ProviderCard.jsx` cross-links, `ProviderBrands.jsx` icons, `components/domains/RegistrarPortfolio.jsx`, `services/api/connections.js`.
-**Still open:** #8 (SMTP), Namecheap registrar, #14/#15 (S3 in the Files app), and Phase 5 #16/#17 (encrypt the *pre-existing* DNS + storage plaintext secrets — note the new registrar secrets are already encrypted).
+**Still open:** Namecheap registrar, #14/#15 (S3 in the Files app), and Phase 5 #16/#17 (encrypt the *pre-existing* DNS + storage plaintext secrets — the new registrar + SMTP-relay secrets are already encrypted).
---
@@ -129,10 +129,11 @@ These four are already drawn as dimmed tiles; the patterns to make them real are
- **Do:** Add `_godaddy_*` branches (`https://api.godaddy.com/v1/domains`, `Authorization: sso-key <key>:<secret>` → reuse the Route 53 two-field form shape), and a catalog entry.
- **Done when:** GoDaddy-hosted DNS records are managed through the same flow.
-### #8 — **SMTP relay** for outbound mail `[M]` ❌
+### #8 — **SMTP relay** for outbound mail `[M]` ❌ — ✅ Done
- **Today:** The `email` category exists with a dimmed `smtp` tile; the mail server has no outbound-relay connection object.
- **Do:** Add an `email`-kind connect form capturing host/port/user/pass/TLS (presets for Postmark / SES / Mailgun) and store encrypted; wire it as the relay for the mail server.
- **Done when:** Outbound mail can route through a configured third-party relay.
+- **Landed:** `EmailRelayConfig` model (single-row, password Fernet-encrypted) + `EmailRelayService` (persist + `smtplib` connection test + apply) + `PostfixService.configure_relay`/`disable_relay` (sets `relayhost` + SASL `sasl_passwd`, `postfix reload`) + `/api/v1/email/relay` GET/PUT/POST-test/DELETE. Frontend: `smtp` tile → live `email` kind; modal `EmailBody` with provider presets (Postmark / SES / Mailgun / SendGrid / custom), STARTTLS + enable toggles, Test/Save/Disable. The Postfix apply is Linux-only and no-ops with a note off-Linux; the `smtplib` test validates credentials on any OS. Verified: `npm run build` + `eslint` (clean) and backend `py_compile` + venv import.
---
diff --git a/frontend/src/components/settings/connections/ConnectProviderModal.jsx b/frontend/src/components/settings/connections/ConnectProviderModal.jsx
index 854b5bce..cfe271be 100644
--- a/frontend/src/components/settings/connections/ConnectProviderModal.jsx
+++ b/frontend/src/components/settings/connections/ConnectProviderModal.jsx
@@ -543,7 +543,7 @@ const SMTP_PRESETS = [
{ id: 'custom', name: 'Custom', host: '', port: 587 },
];
-function EmailBody({ provider, isAdmin, relayConfig, onSave, onTest, onDisable }) {
+function EmailBody({ isAdmin, relayConfig, onSave, onTest, onDisable }) {
const cfg = relayConfig || {};
const [form, setForm] = useState({
provider_hint: cfg.provider_hint || 'custom',