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

whitebox-pro-mail-mailgun

v0.2.0

Published

Mailgun provider for whitebox-pro-server-plugin-mail — send (nodemailer Mailgun transport), inbound + tracking webhook parsing, HMAC-SHA256 signature verification.

Readme

whitebox-pro-mail-mailgun

Mailgun provider for whitebox-pro-server-plugin-mail. Lives in its own repo; the mail plugin stays provider-agnostic and composes this in like any other integration.

import { mail } from 'whitebox-pro-server-plugin-mail'
import { mailgun } from 'whitebox-pro-mail-mailgun'

mail({
  provider: mailgun({
    apiKey:            process.env.WB_MAILGUN_API_KEY,
    domain:            process.env.WB_MAILGUN_DOMAIN,
    webhookSigningKey: process.env.WB_MAILGUN_WEBHOOK_SIGNING_KEY,
    // replayWindowMs: 5 * 60 * 1000,   // reject webhook signatures older than this
  }),
  company: '[email protected]',
  auth: { secret: process.env.WB_MAIL_TOKEN },
})

What it implements

The neutral mail-provider contract the plugin consumes:

| method | Mailgun specifics | |---|---| | send(msg) → { messageId } | nodemailer Mailgun transport; o:tracking header; noreply@{domain} default from; strips <> from the message id | | sendBatch(messages) + maxBatchSize: 1000 | uniform body → one recipient-variables call (ids null, backfilled from webhooks by recipient); personalized → concurrent individual sends with real per-recipient ids | | verifySignature(req, kind) | HMAC-SHA256 over timestamp+token; inbound posts the fields flat, tracking nests them under signature; replay-window check | | parseInbound(req) | sender/recipient/stripped-text/body-html + multipart file attachments | | parseTracking(req) | event-data envelope → canonical event (failed→bounced, etc.); severity, recipient, error message | | ownsAddress(addr) | matches the sending domain (used for inbound to resolution) | | classifyError(err) | HTTP 4xx / known rejection keywords ⇒ permanent (blocklist instead of retry) |

Webhook setup

Both endpoints are public but HMAC-verified by this provider — Mailgun signs every request with your webhook signing key, and the plugin rejects anything unsigned, stale (outside the replay window), or tampered.

1. Signing key. Mailgun dashboard → Settings → Webhook signing key. Put it in WB_MAILGUN_WEBHOOK_SIGNING_KEY. The same key verifies both inbound and tracking.

2. Tracking events. Mailgun → Send → Webhooks (for your sending domain). Point each of these at https://YOUR_HOST/mail/webhooks/tracking:

| Mailgun event | canonical | effect in WhiteBox | |---|---|---| | Delivered | delivered | outbox status → delivered | | Opened | opened | → opened, recorded in awareness | | Clicked | clicked | → engaged, recorded in awareness | | Permanent Failure | bounced | hard bounce → invalid list | | Complained (spam) | complained | → suppression list | | Unsubscribed | unsubscribed | → suppression list |

These POST application/json with Mailgun's event-data + signature envelope. Opens/clicks are only reported for mail sent with tracking on — the outbox worker sets o:tracking per send (default on).

3. Inbound mail / replies. Mailgun → Receiving → Create Route:

  • Expression — e.g. match_recipient(".*@YOUR_DOMAIN")
  • Action — forward("https://YOUR_HOST/mail/webhooks/inbox")

Routes POST multipart/form-data (attachments arrive as files); the same endpoint also accepts JSON, so it works regardless of Mailgun's format.

Both webhook routes live under the mail plugin's mount (/mail), so the full URLs are https://YOUR_HOST/mail/webhooks/tracking and …/mail/webhooks/inbox.

Credentials

All from the environment — never commit them:

  • WB_MAILGUN_API_KEY
  • WB_MAILGUN_DOMAIN
  • WB_MAILGUN_WEBHOOK_SIGNING_KEY