Skip to content

mailerEmail for Node.js, with a reliability layer

SMTP, sendmail, MIME and DKIM of its own, eighteen HTTP providers and JMAP, with failover, retries, rate limits and idempotency around them, and verified webhooks into one model of delivery events. Zero dependencies. On top, a persistent queue with templates of your engine and an audit of every state.

mailer

Status

The transport layer is here, ported from upyo 0.7.0 (MIT), with what nodemailer, unemail and sently did better ported in 1.1: one package, with a subpath per transport and decorator. Delivery events are here too, and, from 1.2, the queue, templates and the audit. See Why @alexify/mailer? for the plan.

A quick look โ€‹

js
const { createMessage } = require('@alexify/mailer');
const { SmtpTransport } = require('@alexify/mailer/smtp');
const { createRetryTransport } = require('@alexify/mailer/retry');

const transport = createRetryTransport(
  new SmtpTransport({
    host: 'smtp.example.com',
    port: 587,
    auth: { user: 'user@example.com', pass: 'secret' },
  }),
  { maxAttempts: 3 },
);

const receipt = await transport.send(
  createMessage({
    from: 'Alex <alex@example.com>',
    to: 'bob@example.net',
    subject: 'Your invoice',
    content: { text: 'Attached.', html: '<p>Attached.</p>' },
  }),
);

if (receipt.successful) console.log(receipt.messageId);
else console.error(receipt.errorMessages, receipt.retryable);

Released under the MIT License.