Docs

MailRelay sits in front of your Resend account. You keep the domain and verification. Your apps just use a MailRelay key.

  1. Create a MailRelay account.
  2. Create a project.
  3. Connect your Resend key.
  4. Set a from address.
  5. Make a MailRelay key.
  6. Call POST /api/send.

Create a project

In the dashboard, make a project for whatever you’re sending — invoices, alerts, whatever. Each one has its own Resend key, from address, keys, and log.

Connect Resend

Make a key in Resend and paste it into the project. We hide it after you save. Verify the sending domain in Resend before you set a from address here.

Make a key

Generate a mr_live_… key for the project. Copy it right away — we only store a hash. You can revoke a key anytime and make a new one.

Send your first email

Put the key in Authorization: Bearer and POST JSON to /api/send.

curl
curl -X POST https://maailrelay-hfrq.vercel.app//api/send \
  -H "Authorization: Bearer YOUR_MAILRELAY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "customer@example.com",
    "subject": "Your invoice is ready",
    "html": "<h1>Your invoice is ready</h1>"
  }'
Node.js
const response = await fetch("https://maailrelay-hfrq.vercel.app//api/send", {
  method: "POST",
  headers: {
    Authorization: "Bearer YOUR_MAILRELAY_API_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    to: "customer@example.com",
    subject: "Your invoice is ready",
    html: "<h1>Your invoice is ready</h1>",
  }),
});

const data = await response.json();
console.log(data);

How to send

POST /api/send

{
  "to": "customer@example.com",
  "subject": "Your invoice is ready",
  "html": "<h1>Your invoice is ready</h1>",
  "text": "Your invoice is ready"
}

Success

{
  "success": true,
  "messageId": "resend-message-id"
}

Errors

{
  "success": false,
  "error": {
    "code": "INVALID_REQUEST",
    "message": "A valid recipient email is required."
  }
}
  • UNAUTHORIZED — missing, invalid, or revoked key (401)
  • INVALID_REQUEST — validation failed (400)
  • PROJECT_NOT_CONFIGURED — missing from address (409)
  • RESEND_NOT_CONNECTED — no Resend key on the project (409)
  • INVALID_SENDER — from address rejected (400)
  • RESEND_ERROR — provider rejected the send (502)
  • INTERNAL_ERROR — unexpected failure (500)
  • RATE_LIMITED — more than 60 requests / minute / key (429)

Google Apps Script

Google Apps Script
const response = UrlFetchApp.fetch(
  "https://maailrelay-hfrq.vercel.app//api/send",
  {
    method: "post",
    contentType: "application/json",
    headers: {
      Authorization: "Bearer YOUR_MAILRELAY_API_KEY"
    },
    payload: JSON.stringify({
      to: "customer@example.com",
      subject: "Your invoice is ready",
      html: "<h1>Your invoice is ready</h1>"
    }),
    muteHttpExceptions: true
  }
);

Logger.log(response.getContentText());