npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@breadstone/archipel-platform-mailing

v0.0.32

Published

Email delivery with strategy-based transport and template engines for NestJS applications.

Downloads

3,968

Readme

@breadstone/archipel-platform-mailing

Multi-strategy email delivery for NestJS with support for SMTP, Postmark, Resend, SendGrid, and Mailgun.

Features

  • Multi-provider — Switch between SMTP, Postmark, Resend, SendGrid, or Mailgun via config
  • Subpath imports — Each provider lives in its own subpath — install only the SDK you need
  • Template engines — File-based or blob-based template fetching with variable substitution
  • Health checksMailHealthIndicator for readiness probes (separate /health subpath)
  • SMTP connection verificationSmtpConnectionVerifier for verifying SMTP server reachability and sending test emails
  • Attachment support — Send file attachments with MIME-type validation and size limits (25 MB max)
  • Header injection prevention — Subject lines are automatically sanitized against SMTP header injection

Deprecation notice: MailVerificationService is deprecated. Use SmtpConnectionVerifier instead — it provides verifyConnection() and sendTestEmail() methods.

⚠️ Environment Variables

Core mailing configuration

| Variable | Required | Default | Description | | ----------------------------- | -------- | ------- | ------------------------------------------------ | | MAIL_TEMPLATE_STRATEGY | yes | - | Template fetch strategy (file or blob) | | MAIL_DELIVERY_STRATEGY | yes | - | Delivery strategy (log, smtp, or postmark) | | MAIL_SENDER_EMAIL | yes | - | Sender address for the From header | | MAIL_TEMPLATE_ENGINE_FORMAT | yes | - | Template engine format identifier |

Postmark provider

| Variable | Required | Default | Description | | ----------------------- | ------------------------------------------ | ------- | ---------------- | | MAIL_POSTMARK_API_KEY | yes when MAIL_DELIVERY_STRATEGY=postmark | - | Postmark API key |

SMTP provider

| Variable | Required | Default | Description | | -------------------- | -------- | ----------- | --------------------- | | MAIL_SMTP_HOST | no | localhost | SMTP host | | MAIL_SMTP_PORT | no | 587 | SMTP port | | MAIL_SMTP_SECURE | no | false | Use secure SMTP (TLS) | | MAIL_SMTP_USER | no | '' | SMTP username | | MAIL_SMTP_PASSWORD | no | '' | SMTP password |

Health indicator

| Variable | Required | Default | Description | | ----------- | -------- | ------- | ---------------------- | | MAIL_HOST | no | '' | Health-check mail host | | MAIL_USER | no | '' | Health-check mail user | | MAIL_PORT | no | 0 | Health-check mail port |

Quick Start

import { Module } from '@nestjs/common';
import { MailModule } from '@breadstone/archipel-platform-mailing';

@Module({
  imports: [MailModule],
})
export class AppModule {}

Set MAIL_DELIVERY_STRATEGY to one of: smtp, postmark, resend, sendgrid, mailgun, log.

Supported Providers

| Subpath | Class | SDK | | ------------------------------------------------ | -------------------------- | ---------------- | | @breadstone/archipel-platform-mailing/postmark | PostmarkDeliveryStrategy | postmark | | @breadstone/archipel-platform-mailing/resend | ResendDeliveryStrategy | resend | | @breadstone/archipel-platform-mailing/sendgrid | SendGridDeliveryStrategy | @sendgrid/mail | | @breadstone/archipel-platform-mailing/mailgun | MailgunDeliveryStrategy | mailgun.js |

SMTP and Log strategies are built-in (no external SDK required).

Import Options

// Main import (module, service)
import { MailModule, MailService } from '@breadstone/archipel-platform-mailing';

// Built-in strategies
import { SmtpDeliveryStrategy } from '@breadstone/archipel-platform-mailing/smtp';
import { LogDeliveryStrategy } from '@breadstone/archipel-platform-mailing/log';

// Provider-specific (tree-shakable sub-exports)
import { PostmarkDeliveryStrategy, POSTMARK_CONFIG_ENTRIES } from '@breadstone/archipel-platform-mailing/postmark';
import { ResendDeliveryStrategy } from '@breadstone/archipel-platform-mailing/resend';
import { SendGridDeliveryStrategy } from '@breadstone/archipel-platform-mailing/sendgrid';
import { MailgunDeliveryStrategy } from '@breadstone/archipel-platform-mailing/mailgun';

// Health indicator (optional)
import { MailHealthIndicator } from '@breadstone/archipel-platform-mailing/health';

Error Handling

| Error Class | Code | When Thrown | | ------------------- | --------------- | ----------------------------------- | | MailDeliveryError | MAIL_DELIVERY | Provider SDK failure during sending |

Lifecycle

  • Startup (OnModuleInit): MailTemplateEngine preloads and compiles templates.
  • Shutdown (OnModuleDestroy): MailEventSubscriber unsubscribes from event streams.

Peer Dependencies

| Package | Required | Notes | | --------------------------------------------- | -------- | ------------------------------ | | @breadstone/archipel-platform-configuration | Yes | Typed config key support | | @nestjs/common | Yes | NestJS core | | nodemailer | No | Required for SMTP strategy | | postmark | No | Required for Postmark provider | | resend | No | Required for Resend provider | | @sendgrid/mail | No | Required for SendGrid provider | | mailgun.js | No | Required for Mailgun provider | | @breadstone/archipel-platform-health | No | Required for health indicator | | @nestjs/terminus | No | Required for health indicator |

Documentation

📖 Package Docs: .docs/packages/platform-mailing/index.md

Development

# Build
yarn nx build platform-mailing

# Test
yarn nx test platform-mailing

# Lint
yarn nx lint platform-mailing