Skip to main content
Inbound emails is currently in private alpha and only available to a limited number of users. APIs might change before GA.To use the methods on this page, you must upgrade your Resend Node SDK to version resend@6.2.0-canary.2 or later.Join the waitlist.
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 a 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. Here’s how to start receiving emails using a domain managed by Resend.

1. Get your .resend.app domain

Any emails sent to an <anything>@your-generated-domain.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

Next, create a new webhook endpoint to receive email events.
  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"
Add Webhook for Inbound 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"],
    "subject": "Sending this example",
    "attachments": [
      {
        "id": "2a0c9ce0-3112-4728-976e-47ddcd16a318",
        "filename": "avatar.png",
        "content_type": "image/png",
        "content_disposition": "inline",
        "content_id": "img001"
      }
    ]
  }
}

View received emails in the dashboard

You can see all inbound email events in the emails page in the dashboard. Resend will store your emails even if you don’t configure a webhook or if your webhook endpoint is down. There, you will be able to filter emails by their to, from, and subject fields. You can also filter for the date the email was received. Inbound email list in the Dashboard Within each email, you can see the full details of the email, including the HTML and Plain Text body, as well as any attachments. Details for a particular inbound email
You can also list inbound emails using the API or SDKs. See the List Inbound Emails API for more information.

How to process attachments

A common use case for inbound emails is to process attachments.
Webhooks do not include the actual content of attachments, only their metadata. You must call the Attachments API to retrieve the content. This design choice supports large attachments in serverless environments that have limited request body sizes.
Users can forward airplane tickets, receipts, and expenses to you. Then, you can extract key information from attachments and use that data. To do this, call the Attachments API after receiving the webhook event. That API will return a list of attachments with their metadata and content (base64-encoded). Here’s an example of getting attachment data in a Next.js application:
app/api/events/route.ts
import type { NextRequest } from 'next/server';
import { NextResponse } from 'next/server';
import { Resend } from 'resend';

const resend = new Resend('re_xxxxxxxxx');

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

  if (event.type === 'email.received') {
    const { data: attachments } = await resend
      .attachments
      .receiving
      .list({ inboundId: event.data.email_id });

    for (const attachment of attachments) {
      // Decode the content from base64
      const content = Buffer.from(attachment.content, 'base64');
      // Process the attachment content (e.g., save to storage, analyze, etc.)
    }

    return NextResponse.json(attachments);
  }

  return NextResponse.json({});
};

How to forward emails

Inbound emails can also be forwarded to another email address.
Webhooks do not include the actual HTML or Plain Text body of the email. You must call the Inbound API to retrieve them. This design choice supports large payloads in serverless environments that have limited request body sizes.
To forward an email, use the Send Email API. After receiving the webhook event, call the Inbound API, as well as the Attachments API if you want attachment data. Then send the email using the Send Email API. Here’s an example of forwarding an email in a Next.js application:
app/api/events/route.ts
import type { NextRequest } from 'next/server';
import { NextResponse } from 'next/server';
import { Resend } from 'resend';

const resend = new Resend('re_xxxxxxxxx');

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

  if (event.type === 'email.received') {
    const { data: email } = await resend
      .emails
      .receiving
      .get(event.data.email_id);

    const { data: attachments } = await resend
      .attachments
      .receiving
      .list({ inboundId: event.data.email_id });

    const { data, error } = await resend.emails.send({
      from: 'Acme <onboarding@resend.dev>',
      to: ['delivered@resend.dev'],
      subject: event.data.subject,
      html: email.html,
      text: email.text,
      attachments
    });

    return NextResponse.json(data);
  }

  return NextResponse.json({});
};

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 inbound emails without affecting your existing email service.
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 Inbound 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.You can find code samples and instructions on how to verify webhooks in the webhook verification documentation.
I