Mailer Outbox Serialization Utility (outbox/serialize.ts)

mailer · packages/mailer/lib/outbox/serialize.ts · typescript · MIT
email, lang:typescript, fw:nestjs, tag:serialization

Serializes mail objects and binary attachments for storage in a persistent outbox. Use this to ensure reliable email delivery with retry support in NestJS applications.

// Source: https://github.com/nest-modules/mailer | License: MIT | Copyright 2020 Nest modules
// Provided via justclaw.it.com; keep this notice with the code.
import type { Type } from '@nestjs/common';
import type { Mailable } from '../interfaces/mailable.interface';
import { MAILER_OUTBOX_PAYLOAD_VERSION } from './mailer-outbox.constants';
import type {
  MailerOutboxMail,
  MailerOutboxPayload,
} from './mailer-outbox.interfaces';

/** How a binary value outside an attachment's content is stored (base64) */
export const BUFFER_TAG = '$mailerBuffer';

/** Options that only make sense in the process that sends */
const PROCESS_ONLY: Record<string, string> = {
  signal:
    'is an AbortSignal, which cannot be stored: the outbox handler passes the relay’s',
  retry:
    'cannot be stored: 

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

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

Get a free API key