Simple setup & reliable delivery
Add email sending to your Express.js app in minutes with Sidemail's clean API. From transactional emails to scheduled delivery, Sidemail handles the hard parts so your emails land in inboxes every time.
Get startedRead API docsconst sidemail = require("./sidemail");
router.post("/register", async (req, res, next) => {
try {
const { email, name } = req.body;
await sidemail.sendEmail({
toAddress: email,
fromAddress: "[email protected]",
fromName: "Your App",
templateName: "Welcome",
templateProps: { firstName: name },
});
res.status(201).json({ message: "User registered" });
} catch (error) {
next(error);
}
});Start sending emails from your Express app in three steps:
Add Sidemail to your Express.js project with npm:
npm install sidemailCreate a sidemail.js file that exports the configured Sidemail instance. The SDK reads SIDEMAIL_API_KEY from your environment, or you can pass it directly.
// sidemail.js
const configureSidemail = require("sidemail");
const sidemail = configureSidemail({
apiKey: process.env.SIDEMAIL_API_KEY,
});
module.exports = sidemail;Import the configured Sidemail instance and call sidemail.sendEmail inside any Express route handler. Pass the recipient, sender, email template or content, and you're done.
// Example: send a welcome email template
const express = require("express");
const router = express.Router();
const sidemail = require("./sidemail");
router.post("/register", async (req, res, next) => {
try {
const { email, name } = req.body;
// ... create user in database ...
await sidemail.sendEmail({
toAddress: email,
fromAddress: "[email protected]",
fromName: "Your App",
templateName: "Welcome",
templateProps: { firstName: name },
});
res.status(201).json({ message: "User registered" });
} catch (error) {
next(error);
}
});Key features & perks
Sidemail makes it easy to send any transactional email from Express.js. Here are a few common examples with code:
// Express.js: Send an account activation email
const sidemail = require("./sidemail");
router.post("/register", async (req, res, next) => {
try {
const { email, name } = req.body;
const token = generateActivationToken();
await sidemail.sendEmail({
toAddress: email,
fromAddress: "[email protected]",
fromName: "Your App",
templateName: "Account Activation",
templateProps: {
firstName: name,
activateUrl: `https://yourapp.com/activate?token=${token}`,
},
});
res.status(201).json({ message: "User registered" });
} catch (error) {
next(error);
}
});Send an activation email with a one-time link right from your Express registration route.
templateProps.// Express.js: Send a password reset email with Markdown
const fs = require("fs");
const path = require("path");
const sidemail = require("./sidemail");
router.post("/forgot-password", async (req, res, next) => {
try {
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: req.body.email,
markdown: markdown,
templateProps: {
firstName: "Alex",
resetLink: "https://yourapp.com/reset?token=abc123xyz",
expiresIn: "30 minutes",
},
});
res.json({ message: "Reset email sent" });
} catch (error) {
next(error);
}
});Sidemail lets you write email content in Markdown and automatically converts it into responsive, pixel-perfect emails that look great on every device and in every inbox. Each email is branded with your logo and styled to match your project's design.
.md file and keep the sender and subject in frontmatter.resetLink and expiresIn via templateProps, which map to variables in your markdown.// Express.js: Schedule a welcome email for 1 hour from now
const sidemail = require("./sidemail");
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,
});Schedule an email to be delivered later, for example one hour after a user signs up.
scheduledAt field to an ISO 8601 timestamp and Sidemail will deliver the email at exactly that time.// Express.js: Send an invoice email with PDF attachment
const fs = require("fs");
const sidemail = require("./sidemail");
router.post("/send-invoice", async (req, res, next) => {
try {
const pdfData = fs.readFileSync("./invoices/invoice-1042.pdf");
const attachment = sidemail.fileToAttachment("invoice-1042.pdf", pdfData);
await sidemail.sendEmail({
toAddress: req.body.email,
fromAddress: "[email protected]",
fromName: "Your App",
templateName: "Invoice",
templateProps: {
customerName: req.body.name,
invoiceNumber: "#1042",
amount: "$99.00",
dueDate: "April 15, 2026",
},
attachments: [attachment],
});
res.json({ message: "Invoice sent" });
} catch (error) {
next(error);
}
});Send an invoice email with a PDF attachment using a Sidemail premade template and dynamic data from your Express route.
sidemail.fileToAttachment() helper to attach files, then include them in the attachments array.Deliverability best practices
SPF and DKIM are email authentication protocols that prove your emails are legitimately sent from your domain. DMARC builds on top of both, telling mail servers how to handle messages that fail those checks. Together, these three protocols are critical for inbox placement and sender reputation.
Sidemail takes care of SPF, DKIM, and DMARC configuration for you automatically. Your Express.js app sends fully authenticated, best-practice-compliant emails from day one.




The simplest way to build emails
Sidemail's visual email editor is the fastest way to create responsive templates that render correctly in every email client and on every device. No HTML knowledge needed. Add your logo and brand colors, and start sending right away.
Want to move even faster? Choose from a library of production-ready templates for common use cases like password resets, welcome emails, and receipts. Whether you build from scratch or customize an existing template, your emails will look polished everywhere.
Learn moreDeveloper-friendly formatting
Building and maintaining HTML emails by hand is painful, especially when all you want is clean, readable content.
With Sidemail, you write your email body in Markdown and it gets automatically converted into a responsive, well-styled HTML email. Smart formatting like headings, lists, links, and code blocks works out of the box, with no broken layouts or cross-client rendering issues.
Perfect for transactional emails sent from your Express.js routes. Clean content, fast authoring, zero HTML to debug.
Learn more
Ready to send emails from your Express.js app? With Sidemail's API and premade templates, you can integrate in minutes and deliver emails reliably.
Start free trialThe simplest way to send email in Express.js is with an email API like Sidemail. Install the Sidemail SDK (npm install sidemail), initialize it with your API key, and call sidemail.sendEmail() inside any Express route handler. You can send templated or custom emails with just a few lines of code. Sidemail takes care of authentication, formatting, and deliverability for you.
Using a dedicated email API like Sidemail is the most reliable approach. Unlike self‑managed SMTP or basic email libraries, Sidemail gives you automatic DKIM and SPF authentication, managed deliverability, premade email templates, and a simple SDK that fits naturally into Express route handlers and middleware. This means higher inbox placement, less maintenance, and faster development.
Instead of building email HTML in your Express routes, use Sidemail's template system. In the Sidemail dashboard, pick a premade template or create your own with the drag‑and‑drop editor. Then in your Express route, reference the template by templateName and pass personalization data via templateProps. For example, a "Welcome" template with a {firstName} variable can be sent by calling sidemail.sendEmail() with the matching prop. Sidemail merges the data and delivers a well‑formatted email.
Yes. Sidemail supports email attachments. Read the file in Node (as a Buffer) and use the SDK's sidemail.fileToAttachment(name, data) helper to create the attachment object. Then include it in the attachments array of your email payload. Keep total attachment size under about 2.5 MB and use allowed file types like PDF, PNG, JPG, or CSV.
Yes. Add the scheduledAt field with a future ISO 8601 timestamp (for example, 2026-04-10T09:00:00Z) to your sendEmail() call. Sidemail queues the message and delivers it at the specified time. You can view or cancel scheduled emails from the dashboard or via the API.
Wrap your sidemail.sendEmail() call in a try/catch block and pass errors to Express's next(error) function. This lets your global error handler take care of it. Sidemail returns clear error messages and status codes, making it easy to log and debug issues.
Absolutely. Since Sidemail is a standard Node.js SDK, it works anywhere in your Express app. Call it from route handlers, middleware, event emitters, or background jobs. You can also use patterns like Node.js EventEmitter to decouple email sending from your route logic for cleaner code.