Sign inGet Started

Node.js SDK

Send email with Hono

Use the Node.js SDK from a small Hono app or edge-style API route.

Install the SDK

The official SDK is published as @parcelwing/node.

Terminal

npm install @parcelwing/node

Hono route

Keep the SDK client server-side and return only the created message ID to the caller.

src/app.ts

import { Hono } from "hono";
import { ParcelWing } from "@parcelwing/node";
 
const app = new Hono();
const parcelWing = new ParcelWing({ apiKey: process.env.PARCEL_WING_API_KEY! });
 
app.post("/send", async (c) => {
const body = await c.req.json<{ to: string }>();
 
const [message] = await parcelWing.emails.send({
from: "Acme <[email protected]>",
to: body.to,
subject: "Hello from Hono",
text: "This email was sent from a Hono route.",
});
 
return c.json({ id: message?.id });
});
 
export default app;

Notes

The SDK targets modern Node.js runtimes. If you deploy Hono to a non-Node edge runtime, test compatibility with your platform before production use.