An envelope with a check mark for email testing

Test Resend Emails with Tempx: Base URL and Credentials

Keep your Resend email calls and capture their output in a Tempx inbox. Set the SDK base URL to Tempx and use a Tempx connection token as the API key. This guide covers a single email send from a Node.js application.

1. Create your Tempx credential

  1. Sign in to your Tempx account and open MCP connections.
  2. Name the connection, for example Resend development, and select an inbox or choose + Create a new inbox….
  3. Enable the send permission and choose an expiration. Add read/search/wait only if an agent also needs to inspect the inbox.
  4. Click Create connection and copy the full tmcp_… token. It is shown once.

This token is the credential for the capture endpoint. Use it in place of a Resend API key; SMTP usernames and passwords do not authenticate this endpoint. All messages captured with this token go into its selected inbox.

2. Set the base URL and API key

Install the SDK in your application:

npm install resend

Create a local .env file with these values. Replace the placeholder with your complete Tempx token:

RESEND_BASE_URL=https://tempx.uk/resend
RESEND_API_KEY=tmcp_REPLACE_WITH_YOUR_FULL_TEMPX_TOKEN

The SDK base URL ends at /resend. The SDK adds /emails when you call emails.send(). Load these variables before the SDK is imported. Keep the credential server-side and keep your local .env out of version control.

3. Send a test email

Save the following as send-test.mjs. The base URL check catches a missing configuration before a request is made:

if (process.env.RESEND_BASE_URL !== 'https://tempx.uk/resend') {
  throw new Error('Set RESEND_BASE_URL to https://tempx.uk/resend');
}
if (!process.env.RESEND_API_KEY?.startsWith('tmcp_')) {
  throw new Error('Set RESEND_API_KEY to your Tempx connection token');
}

const { Resend } = await import('resend');
const resend = new Resend(process.env.RESEND_API_KEY);

const { data, error } = await resend.emails.send({
  from: 'Demo App <app@example.com>',
  to: 'customer@example.com',
  subject: 'Welcome to the test',
  text: 'Your verification code is 123456.',
  html: '<p>Your verification code is <strong>123456</strong>.</p>',
});

if (error) {
  console.error(error);
  process.exitCode = 1;
} else {
  console.log('Captured message:', data.id);
}

With Node.js 20.6 or newer, load the environment file when starting the script:

node --env-file=.env send-test.mjs

4. Inspect the captured message

Open the inbox selected when you created the connection. The email is stored there even though the example recipient is customer@example.com. Tempx does not deliver it to that address. The captured From address is the connection inbox address, overriding the request’s from field. To and Cc remain in the message; Bcc is kept as envelope metadata.

The HTTP response contains { "id": "…" }. The Resend SDK wraps this into its { data, error } result, so the captured message ID is available as data.id.

Use the HTTP endpoint directly

For a quick terminal check, set the same environment variables in your shell and run:

export RESEND_BASE_URL='https://tempx.uk/resend'
export RESEND_API_KEY='tmcp_REPLACE_WITH_YOUR_FULL_TEMPX_TOKEN'

curl --request POST "$RESEND_BASE_URL/emails" \
  --header "Authorization: Bearer $RESEND_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{"from":"app@example.com","to":"customer@example.com","subject":"Capture check","text":"Hello from curl"}' 

Supported fields and limits

The capture adapter accepts to, cc, bcc, subject, text, html, and base64 attachments with filename, content, and content_type. At least one valid To address and a nonempty text or HTML body are required.

This adapter supports immediate single-message capture. Batch sends, remote attachment paths, hosted templates, scheduling, retrieval, custom headers/reply-to, and idempotency are not implemented. Repeating a send can create another captured message. Capture lets you inspect content; it does not test Resend delivery, domain authentication, or deliverability.

Troubleshooting

See the official Resend Node SDK for SDK configuration and our email testing guide for related workflows.

Connect your test application

Create an inbox-scoped token with send permission to start capturing email.

Open your account