smtpOptions (lib/mailer.ts)

sharetab · src/server/lib/mailer.ts · typescript · MIT
email

Configures SMTP settings and builds email transport for sending magic links, password resets, and alerts.

// Source: https://github.com/sw-carlos-cristobal/sharetab | License: MIT | Copyright 2025-2026 ShareTab Contributors
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * Outgoing email: the SMTP settings (`EMAIL_SERVER_*`, `EMAIL_FROM`) shared by the magic-link
 * provider, the password emails, the admin test email and the auth-expiry alerts; the public URL
 * for links in the emails ShareTab builds; and what to log when a send fails.
 */

import nodemailer from 'nodemailer';
import type { SMTPTransportOptions } from 'nodemailer';
import { logger } from './logger';

// Whether email is set up at all is `parseAuthConfig(...).magicLink` (EMAIL_SERVER_HOST set)
export function smtpOptions() {
  const port = parseInt(process.env.EMAIL_SERVER_PORT ?? '587');
  return {
    h

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

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

Get a free API key