caelum0x 2299eb1ba5 feat(mail): customer dashboard (no-build HTML + vanilla JS)
Login via our own magic links, 3-step onboarding (domain, DNS records, first send),
emails with status timeline, domains, API keys (live/test), webhooks, suppressions,
team, usage + plan. Live/Test switch everywhere. Dev mock server + MOUNT.md listing
the one-line axum mount and missing API pieces. Verified in a headless browser
against the mock (24 screenshots).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-11-13 04:24:04 +03:00

47 lines
1.3 KiB
JavaScript

// Copy-paste code for "send your first email". Resend-compatible wire format.
import { apiBase } from "./api.js";
const base = () => apiBase() || location.origin;
export const curlSnippet = ({ key, from, to, subject }) => `curl -X POST ${base()}/emails \\
-H "Authorization: Bearer ${key}" \\
-H "Content-Type: application/json" \\
-d '{
"from": "${from}",
"to": ["${to}"],
"subject": "${subject}",
"html": "<p>It works.</p>"
}'`;
export const nodeSnippet = ({ key, from, to, subject }) => `const res = await fetch("${base()}/emails", {
method: "POST",
headers: {
Authorization: "Bearer ${key}",
"Content-Type": "application/json",
},
body: JSON.stringify({
from: "${from}",
to: ["${to}"],
subject: "${subject}",
html: "<p>It works.</p>",
}),
});
console.log(await res.json()); // { id: "..." }`;
export const sdkSnippet = ({ key, from, to, subject }) => `import { Mail } from "@scribase/mail";
const mail = new Mail("${key}", { baseUrl: "${base()}" });
const { id } = await mail.emails.send({
from: "${from}",
to: ["${to}"],
subject: "${subject}",
html: "<p>It works.</p>",
});`;
export const smtpSnippet = ({ key, from }) => `host: ${new URL(base()).hostname}
port: 587 (STARTTLS) or 465 (TLS)
user: scribase
password: ${key}
from: ${from}`;