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

@baxcloud/baxmail

v1.0.2

Published

BaxMail SDK for Node.js — transactional email via BaxCloud

Readme

BaxMail SDK for Node.js

Server-side transactional email via BaxMail — for Express, NestJS, Next.js API routes, and any Node.js backend.

For BaxMail webhook verification (and other BaxCloud product webhooks), use @baxcloud/baxcloud-server-sdk alongside this package.

Product-specific SDKs:

Installation

npm install @baxcloud/baxmail
pnpm add @baxcloud/baxmail

Quick Start

import { BaxCloudMailClient } from '@baxcloud/baxmail';

const mail = new BaxCloudMailClient({
  projectId: process.env.BAXCLOUD_PROJECT_ID!,
  apiKey: process.env.BAXCLOUD_API_KEY!,
});

await mail.sendEmail({
  to: '[email protected]',
  subject: 'Welcome to MyApp',
  html: '<h1>Thanks for signing up!</h1>',
  text: 'Thanks for signing up!',
});

Sender address (from / fromName)

By default, BaxMail uses the default sender configured in Dashboard → BaxMail → Setup.

Override per message when needed:

await mail.sendEmail({
  to: '[email protected]',
  subject: 'Your receipt',
  html: '<p>Order #1234 confirmed.</p>',
  from: '[email protected]', // must be on a verified domain
  fromName: 'My App',                        // display name in the inbox
  replyTo: '[email protected]',
});

The from address must belong to a domain verified in BaxMail setup. If omitted, the project default is used.

Verified sending domain (sendingDomain)

When your project has multiple verified domains, pass sendingDomain to pick which domain to send from:

await mail.sendEmail({
  to: '[email protected]',
  subject: 'Brand B update',
  html: '<p>Hello</p>',
  sendingDomain: 'brand-b.com', // → [email protected] (project default local-part)
  fromName: 'Brand B',
});

Client-wide default:

const mail = new BaxCloudMailClient({
  projectId: '...',
  apiKey: '...',
  sendingDomain: 'yourdomain.com',
});

Sent as the X-BaxMail-Domain header. When omitted, BaxMail uses the default from BaxMail Setup.

API Reference

| Method | Description | |--------|-------------| | sendEmail(options) | Send transactional email | | getStats(days?) | Sent / delivered / failed counts | | listLogs(options?) | Paginated delivery logs |

sendEmail options

| Field | Required | Description | |-------|----------|-------------| | to | Yes | Recipient email | | subject | Yes | Email subject | | html | Yes | HTML body | | text | No | Plain-text fallback | | from | No | Override sender address (verified domain) | | fromName | No | Override sender display name | | sendingDomain | No | Verified domain (X-BaxMail-Domain header) when from is omitted | | replyTo | No | Reply-To address | | attachments | No | Base64 attachments | | metadata | No | Stored in delivery logs |

Error handling

import { BaxMailError } from '@baxcloud/baxmail';

try {
  await mail.sendEmail({ to: '[email protected]', subject: 'Hi', html: '<p>Hi</p>' });
} catch (err) {
  if (err instanceof BaxMailError) {
    console.error(err.statusCode, err.code, err.message);
    // err.details?.helpUrl → dashboard link for setup issues
  }
}

Common error codes: BAXMAIL_FEATURE_DISABLED, BAXMAIL_DOMAIN_NOT_VERIFIED, BAXMAIL_SENDER_NOT_CONFIGURED, BAXMAIL_SEND_FAILED.

Full reference: baxcloud.tech/docs/baxmail

Examples

See examples/ for Express and order confirmation samples.

Requirements

  • Node.js 18+
  • BaxMail enabled on your BaxCloud project
  • Verified sending domain (Dashboard → BaxMail → Setup)
  • API key with BaxMail scope

Related SDKs

License

MIT

Support

  • Help: https://baxcloud.tech/dashboard/help
  • Contact: https://baxcloud.tech/contact
  • Documentation: https://baxcloud.tech/docs/baxmail/sdk/node
  • Email: [email protected]