Fast integration & reliable delivery

Send email in Node.js

Integrate email sending into your Node.js app in minutes with a simple API. Sidemail ensures your emails reach inboxes reliably, with built‑in deliverability best practices.

Get startedRead API docs
Send a welcome email template
await sidemail.sendEmail({
	toAddress: user.email,
	fromAddress: "[email protected]",
	fromName: "Your App",
	templateName: "Welcome",
	templateProps: {
		firstName: user.name,
	},
});

Quickstart: Send email in Node.js

Get up and running with Sidemail in three simple steps:

1

Install the Sidemail SDK

Add Sidemail to your project via npm:

npm install sidemail
2

Configure your API key

Import and initialize Sidemail with your API key. The SDK will read SIDEMAIL_API_KEY from your environment, or you can pass it directly.

const configureSidemail = require("sidemail");

const sidemail = configureSidemail({
	apiKey: process.env.SIDEMAIL_API_KEY,
});
3

Send email

Call the sidemail.sendEmail method with your email details (recipient, sender, template or content, etc.). That’s it – your Node.js app sends the email through Sidemail’s API.

// Example: send a welcome email template
await sidemail.sendEmail({
	toAddress: "user.email",
	fromAddress: "[email protected]",
	fromName: "Your App",
	templateName: "Welcome", // template stored in Sidemail
	templateProps: { firstName: "Alice" } // dynamic data for the template
});

Key features & perks

Why Sidemail for Node.js emails

  • Fast Node.js email setup

    Send emails from your Node.js app in minutes with Sidemail. Its modern JSON API and developer‑friendly SDK make integration simple, with clear docs and copy‑paste examples that get you fully set up in under 30 minutes.
  • Reliable email delivery

    Sidemail's rock‑solid infrastructure and careful sender vetting process ensure your emails consistently reach inboxes, not spam folders. It's a reliable choice for developers who need dependable email delivery without the complexity: fast to set up, easy to manage, and built to stay out of your way.
  • Custom sending domain with DKIM & SPF

    Send emails from your own domain with Sidemail and skip the tedious configuration. Sidemail automatically sets up DKIM and SPF for you, two of the most critical factors for strong inbox delivery and sender reputation.
  • All‑in‑one email platform

    Sidemail covers everything you need in a single platform – transactional and marketing emails, newsletters, email automation, subscriber collection, and contact management. Instead of stitching together multiple tools, Sidemail is a complete email solution that handles every use case in one place.
  • Premade email templates & no-code email editor

    Sidemail comes with a library of ready‑to‑use, battle‑tested email templates that look great across every inbox. Need something custom? Sidemail's no‑code email editor makes it easy to edit existing templates or build responsive ones from scratch, without writing a single line of HTML.
  • Best‑in‑class developer experience

    Sidemail's email API is built with busy developers in mind — clear documentation, copy‑paste code examples in multiple languages, and thoughtful features that make integration and day‑to‑day use genuinely easier. From markdown email support and detailed logs to an MCP server and rich API data, Sidemail is the email platform that developers love using.

Node.js transactional email examples

With Sidemail, you can send any transactional emails. Here are a few examples with Node.js code:

// Node.js: Send an account verification email
await sidemail.sendEmail({
  toAddress: user.email,
  fromAddress: "[email protected]",
  fromName: "Your App",
  templateName: "Email Verification",
  templateProps: {
    // e.g. a unique verification URL or code for the user
		verifyUrl: `https://yourapp.com/verify/token=${token}`
  }
});

Verification email

Send a sign-up verification email with a one-time link or code to confirm the user’s address.

  • It’s best practice to include a clear call-to-action (button or link) in verification emails and to ensure the verification link expires for security.
  • Sidemail provides a ready-made account activation template to handle this use case.
// Node.js: Send a payment receipt email
await sidemail.sendEmail({
  toAddress: user.email,
  fromAddress: "[email protected]",
  fromName: "Your App",
  templateName: "Payment Receipt",
  templateProps: {
    userName: user.name,
    amount: "$19.99",
    date: new Date().toLocaleDateString()
  }
});

Receipt or notification email

Send a receipt, invoice, or generic notification to your user.

  • For receipts or order confirmations, include key details (amount, date, items) in the email.
  • Sidemail offers receipt and invoice email templates, and you can pass dynamic data (like item lists, prices) viatemplateProps to populate the template.
  • This ensures users have all the info they need, and the design is consistent.
// Node.js: Schedule a welcome email for 1 hour from now
const scheduledAt = new Date(Date.now() + 60 * 60 * 1000).toISOString();

await sidemail.sendEmail({
	toAddress: "[email protected]",
	fromAddress: "[email protected]",
	fromName: "Your App",
	templateName: "Welcome",
	templateProps: { firstName: "Alex" },
	scheduledAt: scheduledAt,
});

Welcome email with scheduled delivery

Schedule a welcome email to be sent later, for example one hour after sign-up.

  • Use the scheduledAt field with an ISO timestamp to control exactly when the email is sent.
  • This is useful for onboarding flows where you want to delay the first message until the user has had a bit of time in your app.
// Node.js: Send a password reset email with markdown
const fs = require("fs");
const path = require("path");

const markdown = fs.readFileSync(
	path.join(__dirname, "templates/emails/password-reset.md"),
	"utf8"
);

// Subject and sender are defined in the markdown frontmatter
await sidemail.sendEmail({
	toAddress: "[email protected]",
	markdown: markdown,
	templateProps: {
		firstName: "Alex",
		resetLink: "https://yourapp.com/reset?token=abc123xyz",
		expiresIn: "30 minutes",
	},
});

Password reset email sent with Markdown

Sidemail's API gives you an option to write email content in Markdown, which is automatically transformed into into pixel‑perfect, responsive emails that look great in every inbox and on every device. Each email is branded with your logo and styled to match your project's email design.

  • Store your password reset email in a .md file, keep sender and subject in frontmatter.
  • Pass dynamic values via templateProps(such as resetLink and expiresIn), which map directly to variables in your markdown.

Deliverability best practices

SPF, DKIM, and DMARC for transactional email

SPF and DKIM are authentication protocols that verify your emails are legitimately sent from your domain. And DMARC builds on both by instructing mail servers how to handle messages that fail those checks. Together, they are 3 critical factors for inbox delivery and sender reputation.

Sidemail automatically handles SPF, DKIM, and DMARC setup for you, so your Node.js app sends authenticated, best‑practice‑compliant emails from day one.

Sidemail dashboard – Reliable email delivery
Graphics
Sidemail dashboard – No-code email editor
Graphics

The simplest way to build emails

No-code email editor & premade email templates

Sidemail's no‑code email editor is the easiest way to create responsive email templates that render correctly across every client and device. No HTML knowledge required. Add your logo and brand colors, and you're ready to send.

Need to move even faster? Sidemail has a library of production‑ready templates for the most common use cases – password resets, welcome emails, receipts, and more. Whether you're building from scratch or customizing a premade template, we guarantee your emails look great everywhere, every time.

Learn more

Developer‑friendly formatting

Markdown support for Node.js emails

Writing and maintaining HTML emails by hand is tedious, especially when you just want to send clean, readable content.

Sidemail lets you write your email body in Markdown and automatically converts it into a responsive, well‑styled HTML email. You get smart formatting, like headings, lists, links, and code blocks, without worrying about broken layouts or cross‑client rendering issues.

This is ideal for transactional emails generated from your Node.js app – clean content, fast authoring, and zero HTML to debug.

Learn more
Markdown email code example and rendered preview

Get started today

Ready to send transactional emails from your Node.js app? With Sidemail’s API and templates, you can integrate in minutes and send emails reliably.

Start free trial

FAQs

How do I send email in Node.js?

The easiest way to send email in Node.js is by using an email API like Sidemail. First, install the Sidemail SDK (npm install sidemail) and initialize it with your API key. Then use the sendEmail() method to send transactional or templated emails with only a few lines of code. No SMTP setup or server config required. Sidemail handles authentication, formatting, and deliverability for you, so you can focus on building your app.

How do I use email templates in Node.js?

Instead of hard-coding email HTML in Node.js, you can use Sidemail transactional email templates. In the Sidemail dashboard, choose a pre-built template (for example, a welcome email or password reset) or create your own with the drag-and-drop editor. Then in Node.js, send emails by referencing templateName and providing templateProps for personalization. For example, if you have template "Order Confirmation" with variables like {customerName} and {orderTotal} you can call sidemail.sendEmail(...) with those values. Sidemail merges the data and delivers a nicely formatted email. This keeps your emails consistently styled and saves you from dealing with HTML email rendering quirks.

Can I send attachments in Node.js emails?

Yes. Sidemail supports email attachments in Node.js. You can attach files by reading the file in Node (as a Buffer or Base64 string) and including it in the attachments array of the email payload. The Sidemail SDK provides helper fileToAttachment(name, data) to create the attachment object easily. Keep attachments fairly small (under about 2.5 MB total) and use allowed file types (for example PDF, PNG, JPG, CSV). Large files should be shared via a link for better performance.

How do I send HTML emails in Node.js?

With Sidemail, sending HTML emails is easy. The recommended way is to use the Sidemail template system for the best results across different email clients. If you need to send a fully custom HTML email, pass your HTML string to the html field in sidemail.sendEmail() (and optionally include a text version for plain text).

Can I schedule an email to send later?

Yes. Sidemail supports scheduled email delivery. To schedule an email, include scheduledAt in your API request with a future time in ISO 8601 format, for example 2026-03-15T09:00:00Z. Sidemail queues the message and sends it automatically at that time. You can view or cancel scheduled emails from your dashboard or via the API. This makes it easy to prepare emails ahead of time and deliver them exactly when needed without managing your own scheduler or background jobs.