SMTP Transport Architecture & Options

Single-Connection Model

MailPort currently uses a single-connection transport model: for every email message send operation, MailPort establishes a new TCP connection, negotiates TLS via STARTTLS, performs SASL authentication, streams the MIME payload, and issues QUIT to close the socket.

Why Single Connection Was Chosen

Configuration Options

import { smtp } from 'mailport';

const transport = smtp({
  host: 'smtp.example.com',
  port: 587,
  tls: 'starttls', // 'starttls' | 'implicit' | 'none'
  auth: {
    user: process.env.SMTP_USER!,
    pass: process.env.SMTP_PASSWORD!,
  },
  timeouts: {
    connectionMs: 10000,
    greetingMs: 10000,
    commandMs: 10000,
  },
});