Send email from Node.js
Two ways to send from Node, no framework required: the official resend SDK pointed at https://mail-api.scribase.com, or a plain HTTP POST with no dependency at all.
Last checked November 24, 2026.
With the resend SDK
Existing Resend code keeps its shape; only the client construction changes.
import { Resend } from 'resend';
// Before: const resend = new Resend(process.env.RESEND_API_KEY);
const resend = new Resend(process.env.SCRIBASE_MAIL_KEY, {
baseUrl: 'https://mail-api.scribase.com',
});
await resend.emails.send({
from: 'Acme <hello@acme.com>',
to: ['you@example.com'],
subject: 'It works',
html: '<p>Sent through Scribase Mail.</p>',
});With no dependency
Node's built-in fetch works directly against the REST API — useful in a script, a worker or anywhere adding a package is overkill.
// send.mjs — no framework, just Node's fetch
const response = await fetch('https://mail-api.scribase.com/emails', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.SCRIBASE_MAIL_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
from: 'Acme <hello@mail.acme.com>',
to: ['you@example.com'],
subject: 'It works',
html: '<p>Sent through Scribase Mail.</p>',
}),
});
if (!response.ok) {
throw new Error(`Scribase Mail send failed: ${response.status}`);
}
const { id } = await response.json();
console.log(id);Switching existing Resend code with one environment variable
If your code already reads RESEND_BASE_URL (the resend SDK does), no code change is needed at all.
# No code change: the resend SDK reads this variable
RESEND_BASE_URL=https://mail-api.scribase.comGet delivery events back
Webhooks are signed in the Standard Webhooks format and also carry svix-* headers, so resend.webhooks.verify() accepts them unchanged.
import { Resend } from 'resend';
const resend = new Resend(process.env.SCRIBASE_MAIL_KEY, { baseUrl: 'https://mail-api.scribase.com' });
export async function POST(req: Request) {
const payload = await req.text();
// Scribase Mail signs in the Standard Webhooks format and also sends the
// same values as svix-* headers, so the resend verifier works unchanged.
const event = resend.webhooks.verify({
payload,
headers: {
id: req.headers.get('svix-id')!,
timestamp: req.headers.get('svix-timestamp')!,
signature: req.headers.get('svix-signature')!,
},
webhookSecret: process.env.SCRIBASE_MAIL_WEBHOOK_SECRET!, // whsec_...
});
// event.type: 'email.delivered', 'email.bounced', 'email.opened', ...
return new Response('ok');
}Questions people ask
Do I have to use the resend package?
No. Scribase Mail is a REST API; any HTTP client, including Node's built-in fetch, sends mail without a dependency.
What does a send return?
A JSON body with the new email id, the same shape as Resend's response, for example { "id": "..." }.
How do I check whether an email actually delivered?
GET /emails/:id/events, or a webhook: delivered, bounced, complained and opened/clicked events are logged and can be signed and pushed to your own endpoint.