SPB Git forge

spb/rareindex

Public
54commits 1branches 0releases
7.1 MBsize
maindefault branch
10 days agolast push
TypeScript 61.9% HTML 37.2% SQL 0.7%
917 B · 22 lines typescript
Raw Blame History
1/**2 * Send one branded verification e-mail through the configured transport (ops check).3 *   RESEND_API_KEY=… EMAIL_FROM="RareIndex <no-reply@rareindex.io>" pnpm exec tsx scripts/send-test-mail.mts you@example.com4 */5import { existsSync } from 'node:fs';6import path from 'node:path';7import { sendMail, verificationEmail } from '@rareindex/notify';89for (const f of [path.resolve(process.cwd(), '../../.env'), path.resolve(process.cwd(), '.env')]) {10  if (existsSync(f)) process.loadEnvFile(f);11}1213const to = process.argv[2];14if (!to) {15  console.error('usage: send-test-mail.mts <recipient>');16  process.exit(1);17}18const m = verificationEmail({ code: String(Math.floor(100000 + Math.random() * 900000)), minutes: 10 });19const r = await sendMail({ to, ...m, subject: `[RareIndex test] ${m.subject}`, tags: [{ name: 'kind', value: 'verify-test' }] });20console.log(JSON.stringify(r));21process.exit(r.ok ? 0 : 1);22