Skip to main content
Resend supports receiving emails (commonly called inbound) in addition to sending emails. This is useful for:
  • Receiving support emails from users
  • Processing forwarded attachments
  • Replying to emails from customers

How does it work

Resend processes all incoming emails for your Inbound domain, parses the contents and attachments, and then sends a POST request to an endpoint that you choose. To receive emails, you can either use a domain managed by Resend, or set up a custom domain. Inbound email process
Importantly, any email sent to your Inbound domain will be received by Resend and forwarded to your webhook. You can intelligently route based on the to field in the webhook event.For example, if your domain is cool-hedgehog.resend.app, you will receive emails sent to anything@cool-hedgehog.resend.app.The same applies to custom domains. If your domain is inbound.yourdomain.tld, you will receive emails sent to anything@inbound.yourdomain.tld.
Here’s how to start receiving emails using a domain managed by Resend.

1. Get your .resend.app domain

Any emails sent to an <your-alias>@<id>.resend.app address will be received by Resend and forwarded to your webhook. To see your Resend domain:
  1. Go to the emails page.
  2. Select the “Receiving” tab.
  3. Click the three dots button and select “Inbound address.”
Get your Resend domain

2. Configure webhooks

  1. Go to the Webhooks page.
  2. Click Add Webhook.
  3. Enter the URL of your webhook endpoint.
  4. Select the event type email.received.
  5. Click Add.
For develoment, you can create a tunnel to your localhost server using a tool like ngrok or VS Code Port Forwarding. These tools serve your local dev environment at a public URL you can use to test your local webhook endpoint.Example: https://example123.ngrok.io/api/webhook
Add Webhook for Receiving Emails

3. Receive email events

In your application, create a new route that can accept POST requests. For example, here’s how you can add an API route in a Next.js application:
app/api/events/route.ts
import type { NextRequest } from 'next/server';
import { NextResponse } from 'next/server';

export const POST = async (request: NextRequest) => {
  const event = await request.json();

  if (event.type === 'email.received') {
    return NextResponse.json(event);
  }

  return NextResponse.json({});
};
Once you receive the email event, you can process the email body and attachments. We also recommend implementing webhook request verification to secure your webhook endpoint.
{
  "type": "email.received",
  "created_at": "2024-02-22T23:41:12.126Z",
  "data": {
    "email_id": "56761188-7520-42d8-8898-ff6fc54ce618",
    "created_at": "2024-02-22T23:41:11.894719+00:00",
    "from": "Acme <onboarding@resend.dev>",
    "to": ["delivered@resend.dev"],
    "bcc": [],
    "cc": [],
    "message_id": "<example+123>",
    "subject": "Sending this example",
    "attachments": [
      {
        "id": "2a0c9ce0-3112-4728-976e-47ddcd16a318",
        "filename": "avatar.png",
        "content_type": "image/png",
        "content_disposition": "inline",
        "content_id": "img001"
      }
    ]
  }
}

What can you do with Inbound emails

Once you receive an email, you can process it in a variety of ways. Here are some common actions you can take:
Webhooks do not include the email body, headers, or attachments, only their metadata. You must call the the Received emails API or the Attachments API to retrieve them. This design choice supports large attachments in serverless environments that have limited request body sizes.

FAQ

Yes. Once you add the MX record to your domain, you will receive emails for any address at that domain.For example, if your domain is cool-hedgehog.resend.app, you will receive emails sent to anything@cool-hedgehog.resend.app. You can then filter or route based on the to field in the webhook event.The same applies to custom domains. If your domain is inbound.yourdomain.tld, you will receive emails sent to anything@inbound.yourdomain.tld.
Yes. You can add the MX record to any subdomain (e.g. inbound.yourdomain.tld) and receive emails there.
If you already have existing MX records for your root domain, we recommend that you create a subdomain (e.g. inbound.yourdomain.tld) and add the MX record there. This way, you can use Resend for receiving emails without affecting your existing email service.If you still want to use the same domain both in for Resend and your day-to-day email service, you can also set up forwarding rules in your existing email service to forward emails to an address that’s configured in Resend or forward them directly to the SMTP server address that appears in the receiving MX record.
No, you will not lose your emails. Resend stores emails as soon as they come in.Even if your webhook endpoint is down, you can still see your emails in the dashboard and retrieve them using the Receiving API.Additionally, we will retry delivering the webhook event on the schedule described in our webhooks documentation and you can also replay individual webhook events from the webhooks page in the dashboard.
All of Resend’s webhooks include a secret and headers that you can use to verify the authenticity of the request.In our SDKs, you can verify webhooks using resend.webhooks.verify(), as shown below.
// throws an error if the webhook is invalid
// otherwise, returns the parsed payload object
const result = resend.webhooks.verify({
  payload: JSON.stringify(req.body),
  headers: {
    id: req.headers['svix-id'],
    timestamp: req.headers['svix-timestamp'],
    signature: req.headers['svix-signature'],
  },
  webhookSecret: process.env.RESEND_WEBHOOK_SECRET,
})
You can find more code samples and instructions on how to verify webhooks in our webhook verification documentation.