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

driftmail

v1.1.10

Published

This is a library for interacting with the driftmail service api.

Readme

driftmail

Driftmail api client for NodeJS

Installation

You can install the client just by running npm install driftmail:

npm install driftmail

Usage

Setting up the client

Since driftmail uses the project approach for sending emails, one client is dedicated to one project, thus instantiated with an API-Key and a service url. You can either provide your own values to the constructor or add the following variables to your .env file:

DRIFTMAIL_SERVICE_URL=url
DRIFTMAIL_API_KEY=key
import {DriftmailClient} from "driftmail";

const client = new DriftmailClient('api-key', 'service-url')

Of course you do not have to provide the values twice.

Setting up the email

Since you can have many templates and variables within a project, the client works with "email" objects that you can set up and send with the client.

To create an email object, import it and specify the template you want to use it with:

import {Mail} from "driftmail";

const mail = new Mail('my-template')

You cann now add recipients and (global) variables to the mail object. For example, you could provide global variables, then loop over an array of users, create local variables for them and add them to the email:

import {Mail, Recipient} from "driftmail";

const mail = new Mail('my-template');
mail.addVariable({
    event: {
        name: "My Event",
        location: "At my event"
    }
})

const users = [
    {
        name: "John Doe",
        email: "[email protected]"
    },
    {
        name: "Example User",
        email: "[email protected]"
    }]

const recipients = users.map(user => {
    return new Recipient(user.email, {
        name: user.name
    })
})
mail.addRecipients(recipients);

As you can see in this example, we first create the email object with a template name, then add a global variable to it. After that, we create an array of recipients from an array of users where the user's name is a variable and add them to the mail aswell.

Sending the email

You can now send the created email with the client you instantiated at the beginning:

import {DriftmailClient, Mail} from "driftmail";

const client = new DriftmailClient();
const mail = new Mail('my-template');

//Add recipients, variables etc. here

const requestId = await client.send(mail);

When the email was successfully sent, the client will return a "request id" which you can store and check the status of your emails later (since sending 100s of emails can take a while!). This is a uuid in string format.

Checking your emails status

After sending your email, you can check its status with the client to see if all your emails were successfully sent or some failed:

import {DriftmailClient} from "driftmail"

const client = new DriftmailClient();
const jobs = await client.getStatus(requestId);

This status is now a class that prefilters waiting, failed and successful jobs for you.

import {DriftmailClient} from "driftmail"

const client = new DriftmailClient();
const jobs = await client.getStatus(requestId);


const allJobs = jobs.getAll();
const failedJobs = jobs.getFailed();
const successfulJobs = jobs.getSuccessful();
const waitingJobs = jobs.getWaiting();