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

sendora

v1.0.0

Published

A developer-first email service library for Node.js

Readme

sendora

npm version license author repo

A developer-first email service library for Node.js that simplifies sending emails with templates, multiple providers, and excellent developer experience.

Features

  • Simple API - Intuitive interface for sending emails
  • Multiple Providers - SMTP support with Nodemailer (SendGrid, Resend, Mailgun coming soon)
  • Template Engine - Handlebars-based templates with layouts and partials
  • Type-safe - Full TypeScript support with strong typing
  • Queue Support - Built-in queue for background email processing
  • Developer-friendly Logging - Powered by pino
  • Configuration Validation - Zod-powered validation

Installation

npm install sendora

Quick Start

import { Sendora } from 'sendora';

const mail = new Sendora({
  provider: 'smtp',
  smtp: {
    host: 'smtp.gmail.com',
    port: 587,
    secure: false,
    auth: {
      user: process.env.MAIL_USER,
      pass: process.env.MAIL_PASS,
    },
  },
});

await mail.initialize();

await mail.send({
  to: '[email protected]',
  subject: 'Welcome',
  html: '<h1>Hello World!</h1>',
});

Configuration

SMTP Configuration

const mail = new Sendora({
  provider: 'smtp',
  smtp: {
    host: 'smtp.gmail.com',
    port: 587,
    secure: false,
    auth: {
      user: '[email protected]',
      pass: 'your-app-password',
    },
  },
  from: 'Your App <[email protected]>',
});

Full Configuration Options

const mail = new Sendora({
  provider: 'smtp',
  smtp: {
    host: 'smtp.gmail.com',
    port: 587,
    secure: false,
    auth: {
      user: process.env.MAIL_USER,
      pass: process.env.MAIL_PASS,
    },
  },
  from: 'Sender <[email protected]>',
  templates: {
    dir: './templates',
    ext: '.hbs',
    layouts: {
      dir: './templates/layouts',
      default: 'main',
    },
    partials: {
      dir: './templates/partials',
    },
    defaultData: {
      company: 'My Company',
      year: new Date().getFullYear(),
    },
  },
  queue: {
    enabled: true,
    concurrency: 5,
    delay: 1000,
  },
  logger: {
    enabled: true,
    level: 'debug',
    prettyPrint: true,
  },
  defaultHeaders: {
    'X-Mailer': 'Sendora',
  },
});

Email Options

await mail.send({
  from: 'Sender <[email protected]>',
  to: ['[email protected]', '[email protected]'],
  cc: '[email protected]',
  bcc: '[email protected]',
  subject: 'Email Subject',
  text: 'Plain text version',
  html: '<h1>HTML version</h1>',
  replyTo: '[email protected]',
  attachments: [
    {
      filename: 'document.pdf',
      path: '/path/to/file.pdf',
    },
  ],
  headers: {
    'X-Custom-Header': 'value',
  },
});

Templates

Creating Templates

Create your templates in the configured templates directory:

{{!-- templates/welcome.hbs --}}
<h2>Hello {{name}}!</h2>
<p>Welcome to {{company}}.</p>

Using Templates

await mail.send({
  to: '[email protected]',
  subject: 'Welcome!',
  template: 'welcome',
  data: {
    name: 'John',
    company: 'Acme Inc',
  },
});

Layouts

{{!-- templates/layouts/main.hbs --}}
<!DOCTYPE html>
<html>
<head>
  <title>{{title}}</title>
</head>
<body>
  {{{body}}}
</body>
</html>

Partials

{{!-- templates/partials/button.hbs --}}
<a href="{{url}}" class="btn">{{text}}</a>
{{!-- Usage in template --}}
{{> button url="https://example.com" text="Click Me" }}

Custom Helpers

const mail = new Sendora({
  provider: 'smtp',
  smtp: { /* ... */ },
  templates: {
    helpers: {
      uppercase: (str: string) => str.toUpperCase(),
      formatDate: (date: Date) => date.toLocaleDateString(),
    },
  },
});

Queue Support

Enable the built-in queue for background email processing:

const mail = new Sendora({
  provider: 'smtp',
  smtp: { /* ... */ },
  queue: true,
});

await mail.initialize();

await mail.send({
  to: '[email protected]',
  subject: 'Welcome',
  template: 'welcome',
  data: { name: 'John' },
});

console.log(mail.getQueueSize());

Logging

const mail = new Sendora({
  provider: 'smtp',
  smtp: { /* ... */ },
  logger: {
    enabled: true,
    level: 'info',
    prettyPrint: true,
  },
});

Log levels: trace, debug, info, warn, error, fatal

Error Handling

import { Sendora, TemplateNotFoundError, ProviderError } from 'sendora';

try {
  await mail.send({
    to: '[email protected]',
    template: 'nonexistent',
  });
} catch (error) {
  if (error instanceof TemplateNotFoundError) {
    console.error('Template not found:', error.message);
  } else if (error instanceof ProviderError) {
    console.error('Provider error:', error.message);
  }
}

Type Safety

interface WelcomeData {
  name: string;
  company: string;
}

await mail.send<WelcomeData>({
  to: '[email protected]',
  template: 'welcome',
  data: {
    name: 'John',
    company: 'Acme',
  },
});

API Reference

new Sendora(config)

Creates a new Sendora instance.

Parameters:

  • config - Configuration object

mail.send(options)

Sends an email.

Parameters:

  • options - Email options

Returns: Promise<SendEmailResponse>

mail.sendBulk(emails)

Sends multiple emails.

Parameters:

  • emails - Array of email options

Returns: Promise<SendEmailResponse[]>

mail.initialize()

Initializes the template engine.

Returns: Promise<void>

mail.close()

Closes the provider connection.

Returns: Promise<void>

mail.getQueueSize()

Returns the number of queued emails.

Returns: number

mail.clearQueue()

Clears all queued emails.

License

MIT © Nurul Islam Rimon

Contributing

Contributions are welcome! This project is open source and we invite developers to contribute.

Ways to Contribute

  • Bug Reports - Open an issue with clear steps to reproduce
  • Feature Requests - Suggest new features or improvements
  • Pull Requests - Submit patches or new features
  • Documentation - Improve docs, examples, or add translations
  • Testing - Add more test cases

Getting Started

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Development Setup

# Clone the repo
git clone https://github.com/nurulislamrimon/sendora.git
cd sendora

# Install dependencies
npm install

# Run tests
npm test

# Build
npm run build

We appreciate all contributions, no matter how small!