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

otp-mailer-js

v1.1.0

Published

A simple JavaScript library for generating OTPs and sending them securely via email.

Readme

OTP Mailer JS

A simple JavaScript library for generating and sending One-Time Passwords (OTPs) via email. It leverages the nodemailer library for sending emails and uses a cryptographically secure pseudo-random number generator to generate OTPs.

Overview

otp-mailer-js allows you to quickly integrate OTP functionality into your application. It is designed to be easy to use, secure, and effective for use cases such as login or signup verification. The OTPs are sent to a specified email address and can be customized for different lengths.

Tech Stack

  • Node.js
  • JavaScript
  • Nodemailer (for sending emails)
  • Jest (for testing)

Features

  • Generate and send OTPs to an email address
  • Customizable OTP length
  • Secure random OTP generation
  • Easy-to-use API
  • Built with Nodemailer for email delivery

Installation

To install the otp-mailer-js package, you can use npm:

npm install otp-mailer-js

Usage

After installing the package, you can use it to generate and send OTPs to a specified email address. Here's an example usage:

Import the Package

const otpmailer = require('otp-mailer-js');

Generate and Send OTP

const email = '[email protected]'; // The recipient's email address
const otp_length = 6; // The desired OTP length

otpmailer(email, otp_length)
  .then(response => {
    console.log('OTP sent successfully:', response);
  })
  .catch(error => {
    console.error('Error sending OTP:', error);
  });

In the above example

email: The recipient's email address to which the OTP will be sent.

otp_length: The desired length of the OTP (e.g., 6 digits, 8 characters, etc.).

The otp-mailer-js function generates the OTP and sends it via email.

Example Email Content

The generated OTP will be sent in a simple text-based email, similar to the following:

Subject: Your OTP Code

Body: Your One-Time Password (OTP) is: 123456

Testing

This package is tested using Jest. You can run the tests by using the following command:

npm test

Contribution

Feel free to open issues, fork the repository, or submit pull requests. Contributions are always welcome!

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contact

For any questions or support, feel free to reach out via GitHub issues or at [email protected].