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
- Sign in to your Tempx account and open MCP connections.
- Name the connection, for example Resend development, and select an inbox or choose + Create a new inbox….
- Enable the send permission and choose an expiration. Add read/search/wait only if an agent also needs to inspect the inbox.
- 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.
- Up to 10 recipients total across To, Cc, and Bcc.
- 30 captures per connection per 5 minutes; requests larger than 8 MiB are rejected.
- Subject, text, and HTML are truncated to 500, 64,000, and 128,000 characters respectively.
- Up to 10 attachments, each truncated to 2 MiB of base64 characters. Keep files below this limit to preserve their contents.
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
- 401: check that the full Tempx token is present, unexpired, and not revoked.
- 403: create a connection with send enabled.
- 404: use
https://tempx.uk/resendas the SDK base URL, orhttps://tempx.uk/resend/emailsfor a direct POST. - 422: check recipients, the body, and the total recipient limit.
- 429: wait for the duration indicated by the response’s
Retry-Afterheader. - No message in the expected inbox: check which inbox the token is bound to; the To address does not select the capture destination.
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