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

custom-email-otp-template

v1.0.0

Published

Customizable HTML email OTP templates for Node.js applications

Readme

Custom Email OTP Template

A lightweight and customizable HTML email OTP template generator built with TypeScript.

Generate beautiful, responsive OTP verification emails using ready-made templates and custom branding.

Features

  • Multiple email templates: Default, Modern, and Dark.
  • Custom company name and branding.
  • Custom OTP expiration time.
  • Custom brand colors.
  • Custom logo support.
  • Support email configuration.
  • TypeScript support.
  • HTML escaping for dynamic text.
  • Input validation.
  • No email service dependency.

Installation

npm install custom-email-otp-template

Basic Usage

import { generateOtpEmail } from "custom-email-otp-template";

const email = generateOtpEmail({
    companyName: "My Company",
    otp: "583921"
});

console.log(email.html);

Available Templates

Default Template

const email = generateOtpEmail({
    companyName: "My Company",
    otp: "583921",
    template: "default"
});

Modern Template

const email = generateOtpEmail({
    companyName: "My Company",
    otp: "583921",
    template: "modern",
    brandColor: "#2563eb"
});

Dark Template

const email = generateOtpEmail({
    companyName: "My Company",
    otp: "583921",
    template: "dark",
    brandColor: "#60a5fa"
});

Custom Branding

const email = generateOtpEmail({
    companyName: "Tech Solutions",
    otp: "583921",
    expiresIn: "5 minutes",
    brandColor: "#2563eb",
    template: "modern",
    logoUrl: "https://example.com/logo.png",
    supportEmail: "[email protected]"
});

Configuration Options

| Property | Type | Required | Default | |---|---|---|---| | companyName | string | Yes | — | | otp | string | Yes | — | | expiresIn | string | No | 5 minutes | | brandColor | string | No | #2563eb | | logoUrl | string | No | — | | template | string | No | default | | supportEmail | string | No | — |

Using with Nodemailer

This package generates HTML only. You can send the generated HTML using Nodemailer.

npm install nodemailer
import nodemailer from "nodemailer";
import { generateOtpEmail } from "custom-email-otp-template";

const email = generateOtpEmail({
    companyName: "My Company",
    otp: "583921",
    template: "modern"
});

const transporter = nodemailer.createTransport({
    host: process.env.SMTP_HOST,
    port: Number(process.env.SMTP_PORT),
    secure: true,
    auth: {
        user: process.env.SMTP_USER,
        pass: process.env.SMTP_PASSWORD
    }
});

await transporter.sendMail({
    from: process.env.SMTP_USER,
    to: "[email protected]",
    subject: "Email Verification",
    html: email.html
});

Important Notes

  • This package generates email HTML; it does not generate OTPs.
  • This package does not send emails.
  • Generate and securely verify OTPs in your own application.
  • Never log or expose OTP values in production.
  • OTP expiration and verification must be enforced by your application.
  • Use a trusted HTTPS image URL for your logo.

Development

npm install
npm run build
npm test

License

MIT License