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

mailcub

v2.0.13

Published

This package enables users to send emails using their registered domains, providing a professional and branded approach to communication.

Readme

Mailcub — Node.js SDK to send transactional emails and newsletters from your own domain using the MailCub email API.

Mailcub is a lightweight Node.js package for sending HTML or plain‑text emails and attachments from your own domain via the MailCub email API. It’s built for transactional emails, app notifications, and simple newsletters without managing SMTP servers yourself.

npm version npm downloads license


Installation

npm install mailcub

Quick example (30-second demo)

const mailcub = require('mailcub');

const emailBody = {
  email_from: '[email protected]',
  receiver: '[email protected]',
  subject: 'Welcome',
  html: '<h1>Hello!</h1><p>Thanks for signing up.</p>'
};

mailcub.sendMail(emailBody, 'your-secret-key')
  .then(() => console.log('Email sent'))
  .catch(err => console.error('Error:', err));

Get your secret key at mailcub.com.


Full API & options

sendMail(body, key)

Sends an email. Returns a Promise.

| Parameter | Type | Description | |-----------|------|-------------| | body | Object | Email payload (see below). | | key | String | Secret key for authentication. From mailcub.com. |

body object

| Field | Type | Required | Description | |-------|------|----------|-------------| | email_from | string | Yes | Sender email (use an address on your registered domain). | | receiver | string | Yes | Recipient email address. | | subject | string | Yes | Email subject line. | | html | string | No* | HTML body of the email. | | text | string | No* | Plain-text body of the email. Use html or text (or both). | | attachment | File or File[] | No | Single file or array of files (file objects only, not paths). |

*At least one of html or text is required.

Examples

Plain text only

mailcub.sendMail({
  email_from: '[email protected]',
  receiver: '[email protected]',
  subject: 'Order confirmation',
  text: 'Thank you for your order. Order #1234 has been received.'
}, process.env.MAILCUB_SECRET_KEY);

HTML only

mailcub.sendMail({
  email_from: '[email protected]',
  receiver: '[email protected]',
  subject: 'Order confirmation',
  html: '<h1>Order #1234</h1><p>Thank you for your order.</p>'
}, process.env.MAILCUB_SECRET_KEY);

With a single attachment

// attachment = file from request, Postman, etc.
mailcub.sendMail({
  email_from: '[email protected]',
  receiver: '[email protected]',
  subject: 'Your invoice',
  html: '<p>Please find your invoice attached.</p>',
  attachment
}, process.env.MAILCUB_SECRET_KEY);

With multiple attachments

// attachment = array of files (e.g. from request, Postman, etc.)
mailcub.sendMail({
  email_from: '[email protected]',
  receiver: '[email protected]',
  subject: 'Your documents',
  html: '<p>Attached are the requested files.</p>',
  attachment: [file1, file2]
}, process.env.MAILCUB_SECRET_KEY);

Using async/await

const mailcub = require('mailcub');

async function sendWelcomeEmail(to) {
  try {
    await mailcub.sendMail({
      email_from: '[email protected]',
      receiver: to,
      subject: 'Welcome',
      html: '<h1>Welcome!</h1>'
    }, process.env.MAILCUB_SECRET_KEY);
    return true;
  } catch (err) {
    console.error(err);
    return false;
  }
}

Why choose Mailcub?

  • Simple API — One function, clear parameters; no SMTP or server config.
  • Your domain — Send from your own domain for a professional, branded look.
  • HTML or plain text — Send rich HTML or simple plain-text emails (or both).
  • Attachments — Single or multiple file attachments.
  • Secret-key auth — Secure authentication; keep your key in env vars.
  • Lightweight — Minimal dependencies; fits into existing Node.js apps.
  • Transactional & newsletters — Suited for both one-off emails and bulk sending.

Troubleshooting & FAQ

Where do I get the secret key?
Sign up and get your key at mailcub.com.

"Error sending email" or failed requests

  • Ensure email_from uses a domain you’ve registered in Mailcub.
  • Check that your secret key is correct and not expired.
  • Verify receiver and subject are non-empty; include at least one of html or text.

Attachments not sending

  • attachment must be file(s) (e.g. from request, Postman, or your app), not path strings.
  • For multiple files, pass an array: attachment: [file1, file2].

Need help?
Contact [email protected] or open an issue: GitHub Issues.


Contributing & Code of Conduct

Contributions are welcome. Please open an issue or pull request on GitHub. Be respectful and constructive; we expect a courteous, inclusive environment for everyone.


License & Author