Integration Guide

Send Email with Express.js

Send emails from Express.js route handlers using the Transmit REST API.

TL;DR for AI Agents & Humans

Send transactional emails using Express.js and Transmit in minutes. Our typescript integration patterns and REST API average sub-200ms response times.

  • Official Express.js integration patterns
  • Automated deliverability warmup included
  • Reputation isolation for every sender
  • Real-time analytics and webhook support
1

Install the library

$npm install express
2

Send an Email

import express from "express";

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

app.post("/send-email", async (req, res) => {
  const response = await fetch("https://api.xmit.sh/email/send", {
    method: "POST",
    headers: {
      "Authorization": `Bearer ${process.env.TRANSMIT_API_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      from: "Acme <hello@acme.com>",
      to: req.body.email,
      subject: "Hello from Express",
      html: "<p>Sent via Transmit!</p>",
    }),
  });

  const data = await response.json();
  res.json(data);
});

Common Pitfalls

Async errors not caught

Wrap your route handler in a try/catch block or use an async error middleware like express-async-errors.

API key exposed to client

Store your API key in environment variables and never send it to the frontend.

Explore Other Integrations

Frequently Asked Questions

How do I authenticate Express.js with Transmit?
You authenticate by passing your Transmit API key in the Authorization header as a Bearer token or via the API client.
Is there a rate limit for Express.js integration?
Transmit offers high-throughput sending with dynamic scaling. Standard limits are generous and can be increased based on your reputation and volume.