Null Mail Transport (transports/null.ts)

trigger.dev · internal-packages/emails/src/transports/null.ts · typescript · Apache-2.0
ui, email, infra, dev-tools, testing

A no-op email transport that logs rendered email content to the console instead of sending real emails, useful for local development or testing.

// Source: https://github.com/triggerdotdev/trigger.dev | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
import { render } from "@react-email/render";
import type { MailMessage, MailTransport, PlainTextMailMessage } from "./index";

export type NullMailTransportOptions = {
  type: undefined;
};

export class NullMailTransport implements MailTransport {
  constructor(options: NullMailTransportOptions) {}

  async send({ to, subject, react }: MailMessage): Promise<void> {
    const plainText = await render(react, {
      plainText: true,
    });

    console.log(`
##### sendEmail to ${to}, subject: ${subject}

${plainText}
    `);
  }

  async sendPlainText({ to, subject, text }: Pla

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

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

Get a free API key