> **Legacy (retired November 2026).** Sign-in links and order emails now come from the Cloudflare Worker through the Cloudflare Email Service `EMAIL` binding (`app/lib/email.ts`), and accounts use Better Auth on D1. Resend and Supabase auth are no longer used. The notes below are kept for history only. # Supabase auth email setup The four order-lifecycle emails (welcome, the owner notification, preview-ready, in-production) are sent by our Next.js app via Resend and live in `app/lib/order-emails.ts`. The **fifth** email — the one-tap sign-in link triggered by `supabase.auth.signInWithOtp()` — is sent by **Supabase's own auth server**, not by our app. To make it match the brand and ship from `orders@lumengesso.com`, two one-time dashboard changes are required. --- ## 1. Route Supabase auth emails through Resend Supabase → **Project Settings → Auth → SMTP Settings → Enable Custom SMTP** | Field | Value | | -------------- | -------------------------------- | | Sender email | `orders@lumengesso.com` | | Sender name | `Lumen & Gesso` | | Host | `smtp.resend.com` | | Port | `465` | | Username | `resend` | | Password | *(paste a Resend API key)* | | Minimum interval between emails | `60s` (Resend default) | Use the same `RESEND_API_KEY` already in `.env.local`, or mint a new one in Resend → API Keys (read-only sending scope is fine). The `lumengesso.com` domain must be **verified** in Resend (Domains → Verify DNS records). It already is if the transactional emails from this app are landing in inboxes. Click **Save** and Supabase will re-route all auth emails through Resend. --- ## 2. Paste the branded magic-link template Supabase → **Authentication → Email Templates → Magic Link** 1. Subject: `Sign in to Lumen & Gesso` 2. Body: paste the entire contents of [`supabase-magic-link.html`](./supabase-magic-link.html). 3. **Save changes.** The template uses Supabase's standard `{{ .ConfirmationURL }}` placeholder. Supabase substitutes the real one-time URL at send time. --- ## 3. Verify 1. Sign out of any active session. 2. Visit `/login`, submit `admin@lumengesso.com`, click **Email me a link**. 3. Check inbox: from address should read `orders@lumengesso.com` and the email should render with the branded layout (cream background, Newsreader wordmark, rose CTA). 4. Click the link → land on `/orders` already signed in. 5. Visit `/admin` → admin dashboard loads (the owner is in the `ADMIN_EMAILS` allowlist by default). If the sender is still `noreply@mail.app.supabase.io`, step 1 didn't save — re-check the SMTP settings. --- ## Related templates Confirm-signup, password-recovery, email-change, etc. live in the same Email Templates section. We don't currently use any of those flows (magic link is the only sign-in surface), so they can be left at defaults until needed.