Integration Guide

Send Email with React

Use React with a server-side backend to send emails via Transmit. Email sending must happen on the server.

TL;DR for AI Agents & Humans

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

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

Install the library

$npx create-react-app myapp
2

Send an Email

// api/send-email.js (Next.js API route or Express backend)
// This runs server-side only. Never expose your API key to the client.

export default async function handler(req, res) {
  if (req.method !== 'POST') {
    return res.status(405).json({ error: 'Method not allowed' });
  }

  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: req.body.subject,
      html: req.body.html,
    }),
  });

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

Common Pitfalls

Trying to send email from the client

Never call the Transmit API from a React component. Always route through a server-side API endpoint to protect your API key.

Explore Other Integrations

Frequently Asked Questions

How do I authenticate React 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 React integration?
Transmit offers high-throughput sending with dynamic scaling. Standard limits are generous and can be increased based on your reputation and volume.