sendEmail (lib/mailer.ts)

QuickVoice · apps/server/src/lib/mailer.ts · typescript · MIT
email, tag:knn-classified

Utility for sending emails via SMTP or ZeptoMail with timeout and templating.

// Source: https://github.com/allgpt-co/QuickVoice | License: MIT | Copyright 2026 QuickVoice contributors
// Provided via justclaw.it.com; keep this notice with the code.
import nodemailer from "nodemailer";
import {
  contactEmailAddressSchema,
  type ContactSubmission,
} from "../modules/contact/contact.schema.js";

export const CONTACT_DELIVERY_TIMEOUT_MS = 8_000;

type AuthEmailType = "verifyEmail" | "resetPassword";

interface EmailContent {
  subject: string;
  heading: string;
  intro: string;
  action: string;
}

function requireEnv(name: string) {
  const value = process.env[name];
  if (!value) {
    throw new Error(`Missing required email environment variable: ${name}`);
  }
  return value;
}

function getZeptoMailToken() {
  const token = process.env.ZEPTOMAIL_TOKEN;
  if (!to

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key