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 🙏

© 2025 – Pkg Stats / Ryan Hefner

emailing-service

v1.0.21

Published

A lightweight **Node.js + TypeScript client** for sending and scheduling emails via a remote mailing API, using SMTP credentials and optional webhooks.

Readme

Mailing

A lightweight Node.js + TypeScript client for sending and scheduling emails via a remote mailing API, using SMTP credentials and optional webhooks.

Designed for backend services, queues, and microservices.


Features

  • SMTP-based email sending
  • Scheduled email delivery
  • Email existence verification
  • Job cancellation for scheduled emails
  • Webhook support
  • Fully typed (TypeScript-first)
  • Axios-powered HTTP client
  • Works with Node.js, Bun, Docker, PM2

Installation

npm install mailing-service

or

pnpm add mailing-service

or

bun add mailing-service

Quick Start

import { Mailing } from "mailing-service";

const mailer = new Mailing({
  host: "https://api.example.com",
  apiKey: "your-api-key",
  credential: {
    host: "smtp.gmail.com",
    port: 587,
    secure: false,
    auth: {
      user: "[email protected]",
      pass: "smtp-password",
    },
  },
});

Send Email

await mailer.send({
  from: "My App <[email protected]>",
  to: "[email protected]",
  subject: "Welcome",
  text: "Hello from Mailing",
});

Schedule Email

const scheduled = await mailer.schedule(
  new Date(Date.now() + 60 * 60 * 1000) // 1 hour later
);

const result = await scheduled.send({
  from: "My App <[email protected]>",
  to: "[email protected]",
  subject: "Scheduled Mail",
  html: "<b>This email was scheduled</b>",
});

// Save the job ID for cancellation if needed
const jobId = result.data.id;

Check Email Existence

const response = await mailer.isEmailExistence("[email protected]");

console.log(response.data.exists); // true or false
console.log(response.data.email); // "[email protected]"

Cancel Scheduled Email

// Cancel a scheduled email job using its job ID
const response = await mailer.cancelMail("job-id-456");

console.log(response.data.status); // true if successful
console.log(response.data.result); // true if job was removed

Configuration

T_Sender

type T_Sender = {
  host: string;
  apiKey?: string;
  credential: {
    host: string;
    port: number;
    secure: boolean;
    auth: {
      user: string;
      pass: string;
    };
  };
  webhook?: string;
};

Fields

| Field | Description | | ------------ | ---------------------------------------- | | host | Base URL of the mailing API | | apiKey | Optional API authentication key | | credential | SMTP server configuration | | webhook | Optional webhook URL for delivery status |


API Reference

new Mailing(config)

Creates a new mailing client instance.


send(email)

Sends an email immediately.

send(data: Omit<Mail.Options, "attachments">): Promise<any>

schedule(date).send(email)

Schedules an email for future delivery.

schedule(date: Date): {
  send(data: Omit<Mail.Options, "attachments">): Promise<any>
}

isEmailExistence(email)

Checks if an email address exists by verifying SMTP response.

isEmailExistence<T>(email: string): Promise<AxiosResponse<T>>

Response:

{
  status: true,
  email: string,
  exists: boolean,
  date: string
}

cancelMail(jobId)

Cancels a scheduled email job by its job ID.

cancelMail<T>(id: string): Promise<AxiosResponse<T>>

Response:

{
  status: true,
  jobId: string,
  result: boolean,
  date: string
}

Notes

  • Attachments are not supported in this client
  • Ensure your SMTP credentials are valid
  • API must expose /mail/send, /mail/schedule, /mail/existence, and /mail/cancel/:jobId
  • Save the jobId from schedule response if you need to cancel the email later
  • Email existence check may return false for valid emails due to SMTP server restrictions

Node.js Support

  • Node.js ≥ 18
  • TypeScript ≥ 5

License

MIT


Author

Sourav


Contributing

Issues and pull requests are welcome.