Node.js SDK

Use your favorite mail provider Zupost, seamless with our node SDK.

Type Safety

Full TypeScript definitions for compile-time checks

Async/Await

Native Promise-based API for modern workflows

There are many various ways of sending emails with Zupost. It can be a template, created in our no-code-editor. HTML, a react email or just markdown. No matter what you prefer, Zupost has it for you. And if you encounter issues with the documentation or the SDK, don't hesitate to open a Issue.

Installation

Start by installing the official Zupost package with your favorite package manager.
pnpm install zupost

Setting Up

After successfully installing Zupost to your project, you can start by creating a Zupost instance.

const zupost = new Zupost('your-api-key');

Sending Emails

You can send emails in various ways, see some usage examples:

Send Html

const { emailId } = await zupost.emails.send({
	from: 'sender@example.com',
	to: 'recipient@example.com',
	subject: 'Hello World',
	html: '<h1>Hello!</h1>',
});

With React

The Zupost SDK is out of the box compatible with sending react emails.

const { emailId } = await zupost.emails.send({
	from: 'sender@example.com',
	to: 'recipient@example.com',
	subject: 'Welcome!',
	react: <WelcomeEmail name="John" />,
});

With a Template

const { emailId } = await zupost.emails.send({
	from: 'sender@example.com',
	to: 'recipient@example.com',
	subject: 'Welcome!',
	templateId: 'welcome-template',
	variables: { name: 'John' },
});

With Attachments

You can attach files to your emails by providing them as base64-encoded strings.

import fs from 'fs';

const { emailId } = await zupost.emails.send({
	from: 'sender@example.com',
	to: 'recipient@example.com',
	subject: 'Invoice',
	html: '<p>Please find the invoice attached.</p>',
	attachments: [
		{
			filename: 'invoice.pdf',
			content: fs.readFileSync('/path/to/invoice.pdf').toString('base64'),
		},
	],
});

Contribute on GitHub

Found an issue or want to contribute? Check out the repository for this project. We welcome contributions of all kinds!

Node.js SDK