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

@toobstudio/send-email

v1.1.4

Published

Secure SDK for sending emails using the TOOB Mail API

Readme

@toobstudio/send-email

NPM Version License

Secure and minimal SDK to send emails via TOOB Mail API with HMAC signature. Built for server-side use in Next.js (App Router) and Node.js projects.


📦 Installation

npm install @toobstudio/send-email

🛠️ Setup

To use this package, you must be registered and have an active account at mail.toob.com.br.

Create a .env.local file in the root of your project with your email credentials:

MAIL_TOOB_API_KEY=your_project_api_key
MAIL_TOOB_SECRET_KEY=your_project_secret_key

⚠️ The environment variable names must be exactly:

  • MAIL_TOOB_API_KEY
  • MAIL_TOOB_SECRET_KEY

These keys are sensitive and must be used only in server-side code. All requests to the TOOB Mail API must be made from server-side code, never from the browser, because the cryptographic signature is generated using your secret key and must not be exposed to the client.


🚀 Usage (in Next.js route handler or Node.js API)

Next.js: Como enviar email via API Route

Next.js: How to send email via API Route

On the frontend, make a request to the API endpoint using a function like this:

// Exemplo de chamada no frontend (React)
async function handleSend(e: React.FormEvent) {
  e.preventDefault();
  setLoading(true);

  try {
    const res = await fetch("/api/email", {
      method: "POST",
      headers: { "Content-Type": "application/json" },
      body: JSON.stringify({ to, subject, message }),
    });

    if (!res.ok) throw new Error("Failed to send");

    toast.success("Email sent successfully!");
  } catch (err) {
    toast.error("Error sending email");
  } finally {
    setLoading(false);
  }
}

On the backend, create an endpoint at app/api/email/route.ts (Next.js 13/14 App Router):

import { NextRequest, NextResponse } from "next/server";
import { sendEmail } from "@toobstudio/send-email";

export async function POST(req: NextRequest) {
  const body = await req.json();
  const { to, subject, message } = body;

  try {
    await sendEmail({ to: [to], subject, message });
    return NextResponse.json({ success: true });
  } catch (err: any) {
    console.error("Error sending:", err);
    return NextResponse.json({ error: err.message }, { status: 500 });
  }
}

✉️ Parameters

interface SendEmailParams {
  to?: string[]; // Optional. If not provided, the email will be sent to the address registered on the site.
  subject: string; // Required
  message: string; // Required (HTML content)
  plain_text?: string; // Optional fallback for text-only clients
}

🧪 Example (Node.js with Express)

import express from "express";
import { sendEmail } from "@toobstudio/send-email";

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

app.post("/contact", async (req, res) => {
  const { name, email, message } = req.body;

  await sendEmail({
    to: ["[email protected]"],
    subject: `Contact from ${name}`,
    message: `<p>${message}</p><p>Email: ${email}</p>`,
  });

  res.status(200).json({ sent: true });
});

🔒 Security

All emails are signed with a secure HMAC SHA-256 signature using your secret key. The request is sent to the TOOB Mail API and verified server-side.


📄 License

MIT © TOOB Creative Studio