v1.4.3These docs are for laramail v1.4.3. View changelog
Introduction & Overview
laramail is the AdonisJS mailer, but framework-agnostic — works with Express, Fastify, or any Node.js app.
The real differentiator: Mail.fake() + Mail.assertSent() for zero-setup email testing. No Mailtrap. No nodemailer mock setup. No grepping console output.
Mail.fake();
await Mail.to('user@example.com').send(new WelcomeEmail(user));
Mail.assertSent(WelcomeEmail, (mail) => mail.hasTo('user@example.com'));Philosophy
- Testing-first —
Mail.fake()is a first-class feature, not an afterthought. Test emails the same way you test everything else. - Framework-agnostic — Inspired by AdonisJS mailer and Laravel's Mail facade. Works with any Node.js framework.
- Lightweight — Base package is ~25 MB (SMTP only). Install additional providers as needed.
- Modular — Providers, template engines, queue drivers, and markdown support are all optional peer dependencies.
- Type-safe — Full TypeScript support with strict typing throughout.
Feature Summary
| Feature | Details |
|---|---|
| Testing | Mail.fake() with Laravel-style send/queue assertions — zero setup |
| Providers | SMTP, SendGrid, AWS SES, Mailgun, Resend, Postmark, Log Transport, Custom |
| Template Engines | Handlebars, EJS, Pug |
| Queue | Bull, BullMQ, Sync (dev) |
| Markdown Mail | Write emails in Markdown with button, panel, and table components |
| Provider Failover | Automatic failover chain with retries, delays, and monitoring callbacks |
| Rate Limiting | Per-provider sliding window rate limiting |
| Email Events | Hook into sending, sent, and failed lifecycle events |
Requirements
- Node.js >= 18
- TypeScript 5.6+ (recommended)
Stats
- 774 tests passing
- 85%+ code coverage
- MIT license