# Custom receiving domains

> Receive inbound email on your own domain by adding an MX record and subscribing a webhook to email.received.

You receive email on your own domain, such as `yourdomain.tld`. Receiving takes one extra DNS record — an `MX` record — on top of the verification you already do for sending.

## 1. Add the MX record

First, [verify your domain](https://www.sendping.co/docs/domains/managing) for sending if you have not already. Receiving then requires an additional `MX` record so mail for the domain is routed to SendPing:

1. **Open Domains** — Go to the Domains page in the dashboard and open the domain you want to receive on.
2. **Copy the MX record** — In the receiving section, copy the `MX` record SendPing shows you (host and priority).
3. **Add it at your DNS provider** — Paste the `MX` record into your DNS provider and save.

> **Warning:** Configure receiving on a dedicated subdomain if your root domain already serves existing mailboxes. MX preference controls the order of delivery attempts; it does not duplicate mail across providers. Use the receiving records shown in SendPing, and plan any root-domain migration with your email administrator. If your existing provider supports forwarding, configure a verified recipient address at the destination rather than treating an MX server hostname as a mailbox.

## 2. Configure a webhook

Create a webhook endpoint subscribed to the `email.received` event, exactly as for a managed domain:

1. **Open Webhooks** — Go to the Webhooks page in the dashboard.
2. **Add a webhook** — Click "Add Webhook" and enter your endpoint URL.
3. **Subscribe to email.received** — Select the `email.received` event type and save.

## 3. Receive email events

Create a route that accepts `POST` requests and handles the `email.received` event:

**Node.js**

```js
// 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({});
};
```

**Python**

```python
from flask import Flask, request, jsonify

app = Flask(__name__)

@app.post("/api/events")
def events():
    event = request.get_json()
    if event.get("type") == "email.received":
        return jsonify(event)
    return jsonify({})
```

After receiving the event you can fetch the message body and attachments. We recommend [verifying the webhook signature](https://www.sendping.co/docs/webhooks/verify) to secure your endpoint. The `email.received` payload shape is identical to a managed domain:

```json
{
  "type": "email.received",
  "created_at": "2026-02-22T23:41:12.126Z",
  "data": {
    "email_id": "56761188-7520-42d8-8898-ff6fc54ce618",
    "created_at": "2026-02-22T23:41:11.894719+00:00",
    "from": "onboarding@test.sendping.co",
    "to": ["delivered@test.sendping.co"],
    "bcc": [],
    "cc": [],
    "received_for": ["forwarded@example.com"],
    "message_id": "<111-222-333@email.example.com>",
    "subject": "Sending this example",
    "attachments": [
      {
        "id": "2a0c9ce0-3112-4728-976e-47ddcd16a318",
        "filename": "avatar.png",
        "content_type": "image/png",
        "content_disposition": "inline",
        "content_id": "img001"
      }
    ]
  }
}
```

## Enabling receiving for an existing domain

If you already have a verified domain, enable receiving with the toggle in the receiving section of the domain detail page. A modal then shows the `MX` record to add at your DNS provider. After you add it, click "I've added the record" and wait for the receiving record to show as **verified**.

> **Note:** You do **not** need to re-verify a domain you already verified for sending. Enabling receiving only verifies the **new** `MX` record — the rest of your domain configuration stays as-is.

## FAQ

### What if I already have MX records for my domain?

A receiving domain needs a deliberate routing setup. Lower-numbered MX preferences are tried first, and eligible alternatives can be used after a failure. Unrelated mailbox providers at different priorities are not independent copies of the same inbox. Use a dedicated receiving subdomain or coordinate a complete migration; see [MX conflicts](https://www.sendping.co/docs/kb/mx-conflicts) before changing existing records.

### Do I need to verify the domain again for receiving?

No. A domain already verified for sending only needs receiving enabled and the new `MX` record added — SendPing verifies that one record.
