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

email-services

v1.0.0

Published

A simple email service with SMTP and webhook support

Readme

Email Service

A simple, configurable email service with SMTP support and webhook tracking. This package allows you to send emails via SMTP, track opens via a tracking pixel, and receive status updates via webhooks.

Note- webhook event can be recieved on only live url not on local

Installation

To install the package, run the following command:

npm install email-service

Usage

  1. Initialize the Email Service Import the EmailService class and initialize it with your SMTP configuration and webhook URL.
const EmailService = require('email-service');

const emailService = new EmailService({
    smtpHost: 'smtp.gmail.com',
    smtpPort: 465,
    username: '[email protected]',
    password: 'your-smtp-password',
    webhookUrl: 'https://your-webhook-url.com/email-status-webhook',
    port: 3000 // Optional: the port for your webhook listener (default is 3000)
});
  1. Send an Email Use the sendEmailSMTP method to send an email with support for tracking and attachments.
emailService.sendEmailSMTP({
    from: '[email protected]',
    to: '[email protected]',
    subject: 'Hello from NPM!',
    body: '<p>This is a test email with tracking.</p>',
    isHtml: true,
    trackingId: '123456',
    // Optional: Add attachments
    // attachments: [
    //     { path: './path/to/file.jpg', filename: 'file.jpg', mimeType: 'image/jpeg' }
    // ]
})
    .then(response => {
        console.log('Email sent successfully:', response);
    })
    .catch(error => {
        console.error('Error sending email:', error);
    });
  1. Webhook for Email Status You can configure a webhook URL to receive notifications about the email's status (e.g., sent, opened, failed). When an email is opened, the email service will send a request to your webhook URL with the status of the email.

Example webhook handler:

const express = require('express');
const bodyParser = require('body-parser');

const app = express();
app.use(bodyParser.json());

app.post('/email-status-webhook', (req, res) => {
    console.log('Received Email Status Event:', req.body);
    res.status(200).send('Event received');
});

app.listen(3000, () => {
    console.log('Webhook listener running at http://localhost:3000');
});
  1. Track Email Opens The email service automatically adds a tracking pixel to each email. When the recipient opens the email, the pixel will be triggered, and a request will be sent to the configured webhook URL.

  2. Server Setup (Optional) If you want to set up the webhook listener locally, you can use the following server configuration

const EmailService = require('email-service');

const emailService = new EmailService({
    smtpHost: 'smtp.gmail.com',
    smtpPort: 465,
    username: '[email protected]',
    password: 'your-smtp-password',
    webhookUrl: 'https://your-webhook-url.com/email-status-webhook',
    port: 3000
});

emailService.sendEmailSMTP({
    from: '[email protected]',
    to: '[email protected]',
    subject: 'Test Email',
    body: '<p>This is a test email with tracking.</p>',
    isHtml: true,
    trackingId: '123456'
})
    .then(console.log)
    .catch(console.error);

Configuration Parameters SMTP Configuration: smtpHost: SMTP server host (e.g., smtp.gmail.com). smtpPort: SMTP server port (e.g., 465 for Gmail SSL). username: Your email address used for authentication. password: Your email password or application-specific password. Webhook Configuration: webhookUrl: The URL that will receive email status updates. Optional: port: The port number for the local webhook server (default is 3000). License MIT License. See LICENSE for details.

Notes:

  • Replace [email protected] and your-smtp-password with your actual credentials.
  • The example webhook server listens on port 3000. You can change the port if needed.
  • The sendEmailSMTP method supports email tracking and optional attachments.
  • The attachments field is commented out in the example. You can use it to attach files to the email