Migrate email pipeline off Lovable + branded auth emails

Replace Lovable-bound email transport and auth webhook so the platform
sends all automated email through its own infrastructure.

- process-email-queue: drop sendLovableEmail/LOVABLE_API_KEY; send via the
  Hostinger Email API (primary) with automatic SMTP fallback. Shared
  transports added in _shared/hostinger-mail.ts and _shared/smtp-send.ts.
- auth-email-hook: verify Supabase's native Send Email hook signature
  (Standard Webhooks via SEND_EMAIL_HOOK_SECRET) instead of Lovable's libs;
  build the GoTrue verify URL; keep enqueue → process-email-queue.
- Recreate the 6 auth email templates under _shared/email-templates/ that
  previously only existed in the deployed function.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-02 23:07:26 -04:00
parent 5bf2a5887e
commit b1486a0b2a
10 changed files with 889 additions and 211 deletions
@@ -0,0 +1,60 @@
/// <reference types="npm:@types/react@18.3.1" />
import * as React from 'npm:react@18.3.1'
import {
Body,
Container,
Head,
Heading,
Html,
Preview,
Text,
} from 'npm:@react-email/components@0.0.22'
interface ReauthenticationEmailProps {
token: string
}
export const ReauthenticationEmail = ({ token }: ReauthenticationEmailProps) => (
<Html lang="en" dir="ltr">
<Head />
<Preview>Your verification code</Preview>
<Body style={main}>
<Container style={container}>
<Heading style={h1}>Confirm reauthentication</Heading>
<Text style={text}>Use the code below to confirm your identity:</Text>
<Text style={codeStyle}>{token}</Text>
<Text style={footer}>
This code will expire shortly. If you didn't request this, you can
safely ignore this email.
</Text>
</Container>
</Body>
</Html>
)
export default ReauthenticationEmail
const main = { backgroundColor: '#ffffff', fontFamily: 'Arial, sans-serif' }
const container = { padding: '20px 25px' }
const h1 = {
fontSize: '22px',
fontWeight: 'bold' as const,
color: '#000000',
margin: '0 0 20px',
}
const text = {
fontSize: '14px',
color: '#55575d',
lineHeight: '1.5',
margin: '0 0 25px',
}
const codeStyle = {
fontFamily: 'Courier, monospace',
fontSize: '22px',
fontWeight: 'bold' as const,
color: '#000000',
margin: '0 0 30px',
}
const footer = { fontSize: '12px', color: '#999999', margin: '30px 0 0' }