feat: packages/email — Maizzle v6 + Tailwind CSS v4 HTML email templates
- New @sexy.pivoine.art/email package with @maizzle/framework@6.0.0-15 - Uses @maizzle/tailwindcss (TW v4 preset) with @theme brand tokens derived from the frontend's app.css oklch primary color - LightningCSS automatically lowers oklch/lab to hex for email clients - Real HTML template files (templates/layouts/main.html, verification.html, password-reset.html) — not JS template strings - PostCSS `from` override so @import "@maizzle/tailwindcss" resolves from the email package's own node_modules - Backend lib/email.ts now calls renderVerification/renderPasswordReset instead of inline HTML strings Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
"@fastify/static": "^8.1.1",
|
||||
"@pothos/core": "^4.4.0",
|
||||
"@pothos/plugin-errors": "^4.2.0",
|
||||
"@sexy.pivoine.art/email": "workspace:*",
|
||||
"@sexy.pivoine.art/types": "workspace:*",
|
||||
"argon2": "^0.43.0",
|
||||
"bullmq": "^5.70.4",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import nodemailer from "nodemailer";
|
||||
import { renderVerification, renderPasswordReset } from "@sexy.pivoine.art/email";
|
||||
import { mailQueue } from "../queues/index.js";
|
||||
|
||||
const transporter = nodemailer.createTransport({
|
||||
@@ -14,24 +15,15 @@ const transporter = nodemailer.createTransport({
|
||||
});
|
||||
|
||||
const FROM = process.env.EMAIL_FROM || "noreply@sexy.pivoine.art";
|
||||
const BASE_URL = process.env.PUBLIC_URL || "http://localhost:3000";
|
||||
|
||||
export async function sendVerification(email: string, token: string): Promise<void> {
|
||||
await transporter.sendMail({
|
||||
from: FROM,
|
||||
to: email,
|
||||
subject: "Verify your email",
|
||||
html: `<p>Click <a href="${BASE_URL}/signup/verify?token=${token}">here</a> to verify your email.</p>`,
|
||||
});
|
||||
const { subject, html } = await renderVerification({ token });
|
||||
await transporter.sendMail({ from: FROM, to: email, subject, html });
|
||||
}
|
||||
|
||||
export async function sendPasswordReset(email: string, token: string): Promise<void> {
|
||||
await transporter.sendMail({
|
||||
from: FROM,
|
||||
to: email,
|
||||
subject: "Reset your password",
|
||||
html: `<p>Click <a href="${BASE_URL}/password/reset?token=${token}">here</a> to reset your password.</p>`,
|
||||
});
|
||||
const { subject, html } = await renderPasswordReset({ token });
|
||||
await transporter.sendMail({ from: FROM, to: email, subject, html });
|
||||
}
|
||||
|
||||
const jobOpts = { attempts: 3, backoff: { type: "exponential" as const, delay: 5000 } };
|
||||
|
||||
Reference in New Issue
Block a user