Bounded-Memory Attachment Streaming

Stream 10 MB, 100 MB, or larger attachments with bounded memory usage.

Supported Attachment Types

import { createReadStream } from 'node:fs';
import { createMailer, smtp } from 'mailport';

const mailer = createMailer({ transport: smtp({ host: process.env.SMTP_HOST! }) });

await mailer.send({
  from: 'reports@example.com',
  to: 'analytics@example.com',
  subject: 'Monthly Export',
  attachments: [
    {
      type: 'stream',
      filename: 'export_100mb.csv',
      stream: createReadStream('./export_100mb.csv'),
    },
  ],
});