🪻 distributed transcription service
thistle.dunkirk.sh
1/**
2 * Send test emails to preview all email templates
3 * Usage: bun scripts/send-test-emails.ts <email>
4 */
5
6import { sendEmail } from "../src/lib/email";
7import {
8 passwordResetTemplate,
9 transcriptionCompleteTemplate,
10 verifyEmailTemplate,
11} from "../src/lib/email-templates";
12
13const targetEmail = process.argv[2];
14
15if (!targetEmail) {
16 console.error("Usage: bun scripts/send-test-emails.ts <email>");
17 process.exit(1);
18}
19
20async function sendTestEmails() {
21 console.log(`Sending test emails to ${targetEmail}...`);
22
23 try {
24 // 1. Email verification
25 console.log("\n[1/3] Sending email verification...");
26 await sendEmail({
27 to: targetEmail,
28 subject: "Test: Verify your email - Thistle",
29 html: verifyEmailTemplate({
30 name: "Test User",
31 code: "123456",
32 token: "test-token-abc123",
33 }),
34 });
35 console.log("✓ Email verification sent");
36
37 // 2. Password reset
38 console.log("\n[2/3] Sending password reset...");
39 await sendEmail({
40 to: targetEmail,
41 subject: "Test: Reset your password - Thistle",
42 html: passwordResetTemplate({
43 name: "Test User",
44 resetLink: "https://thistle.app/reset-password?token=test-token-xyz789",
45 }),
46 });
47 console.log("✓ Password reset sent");
48
49 // 3. Transcription complete
50 console.log("\n[3/3] Sending transcription complete...");
51 await sendEmail({
52 to: targetEmail,
53 subject: "Test: Transcription complete - Thistle",
54 html: transcriptionCompleteTemplate({
55 name: "Test User",
56 originalFilename: "lecture-2024-11-22.m4a",
57 transcriptLink: "https://thistle.app/transcriptions/123",
58 className: "Introduction to Computer Science",
59 }),
60 });
61 console.log("✓ Transcription complete sent");
62
63 console.log("\n✅ All test emails sent successfully!");
64 } catch (error) {
65 console.error("\n❌ Error sending emails:", error);
66 process.exit(1);
67 }
68}
69
70sendTestEmails();