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

@solumjs/email

v0.3.5

Published

SolumJS Email support with SMTP and template engine

Downloads

1,606

Readme

@solumjs/email

SMTP email sending with template engine and test mode.

Install

npm install @solumjs/email

SMTP Configuration

import { SmtpEmail, MailService, TemplateEngine } from "@solumjs/email";
import { Bean } from "@solumjs/core";

@SmtpEmail({
    host: "smtp.gmail.com",
    port: 587,
    secure: false,
    auth: { user: "[email protected]", pass: "app-password" },
    from: "My App <[email protected]>",
})
export class AppEmailClient {}

Sending Emails

import { MailService } from "@solumjs/email";

const mailService = new MailService({
    host: "smtp.gmail.com",
    port: 587,
    from: "My App <[email protected]>",
});

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

// With text fallback
await mailService.send({
    to: "[email protected]",
    subject: "Welcome!",
    html: "<h1>Hello!</h1>",
    text: "Hello!",
});

// With attachments
await mailService.send({
    to: "[email protected]",
    subject: "Your Report",
    html: "<p>Please find attached your report.</p>",
    attachments: [
        { filename: "report.pdf", content: pdfBuffer, contentType: "application/pdf" },
    ],
});

// Multiple recipients
await mailService.send({
    to: ["[email protected]", "[email protected]"],
    cc: "[email protected]",
    bcc: "[email protected]",
    subject: "Team Update",
    html: "<p>Update</p>",
});

EmailOptions Interface

interface EmailOptions {
    to: string | string[];
    cc?: string | string[];
    bcc?: string | string[];
    subject: string;
    text?: string;
    html?: string;
    attachments?: EmailAttachment[];
    from?: string;
    replyTo?: string;
}

interface EmailAttachment {
    filename: string;
    content: Buffer | string;
    contentType?: string;
    cid?: string; // Content-ID for inline images
}

Template Engine

import { TemplateEngine, createTemplateEngine } from "@solumjs/email";

const engine = createTemplateEngine();

// Register templates
engine.register({
    name: "welcome",
    subject: "Welcome to {{platform}}!",
    html: "<h1>Hello {{name}}!</h1><p>Welcome to {{platform}}.</p>",
    text: "Hello {{name}}! Welcome to {{platform}}.",
});

// Render template
const rendered = engine.render("welcome", { name: "John", platform: "SolumJS" });
// { subject: "Welcome to SolumJS!", html: "...", text: "..." }

// List template names
const names = engine.getTemplateNames(); // ["welcome"]

Test Mode

import { enableTestMode, disableTestMode, getSentEmails, getLastSentEmail, clearSentEmails } from "@solumjs/email";

// Enable test mode (no actual emails sent)
enableTestMode();

// Send email (intercepted)
await mailService.send({ to: "[email protected]", subject: "Test", html: "Hello" });

// Retrieve sent emails
const emails = getSentEmails();
expect(emails.length).toBe(1);
expect(emails[0].to).toBe("[email protected]");

// Get last sent email
const last = getLastSentEmail();

// Clear
clearSentEmails();

// Disable test mode
disableTestMode();

Security Features

  • Header sanitization — CRLF injection prevention
  • Address sanitization — Angle bracket and newline stripping
  • Body size limit — 10MB maximum email size
  • STARTTLS — Upgrade to TLS for authentication
  • Timing-safe comparison — For password verification
  • HTML escaping — Template interpolation auto-escapes special characters

License

MIT