# set_site_email_domain_receiving

Source: https://modulify.ai/docs/api/emails/set-site-email-domain-receiving

Turns receiving on or off for one verified email domain of a site, which decides whether mail sent to that domain is forwarded.

- Title: Turn receiving on or off for an email domain
- Scope: `config:write`
- Access: Destructive
- Endpoint: `POST /v1/set_site_email_domain_receiving`

While receiving is on, and while the site's forwarding is on, mail sent to any address at exactly that domain is forwarded to the site's confirmed forwarding addresses, just like mail to the built-in sending domain, replies to a sending address on that domain included. That mail only arrives once the domain's MX record points to the value of its receiving record, which `emailDomains.items` lists while receiving is on. Pointing it there moves all of the domain's mail away from the mailboxes it reaches today, so the tool tells the client to confirm that with you first.

Turning it on is refused while the domain is not verified, with `Only a verified email domain can receive email!`, and while forwarding is not set up on the platform, with `Email forwarding is not set up on this server yet!` It is also refused while one of the site's forwarding addresses is at that domain, because forwarding to it would loop, with `A forwarding address of this site is at this domain, so its mail would come straight back. Remove that address first!`

Turning it off always works. But while the domain's MX record still points here, every message sent to it from then on, and any message still waiting to be forwarded, is dropped and never forwarded later. The tool tells the client to confirm that with you first and to tell you to point the MX record back at your own mailboxes.

It needs the **Delete projects** permission, like the forwarding switch. See [Receive mail at your domain](https://modulify.ai/docs/automations/emails#receive-mail-at-your-domain).

## Request

Call it with a `POST` to `https://api.modulify.ai/v1/set_site_email_domain_receiving`, sending the inputs below as a JSON object. The token needs the `config:write` scope.

> **Warning**
>
> This method is marked destructive: it deletes or overwrites data. Check the inputs before you call it, and send an [Idempotency-Key](https://modulify.ai/docs/api/idempotency) header whenever you might retry it.

```bash
curl -X POST https://api.modulify.ai/v1/set_site_email_domain_receiving \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"projectId":"PROJECT_ID","domainId":"DOMAIN_ID","enabled":true}'
```

Over MCP, the same method is the [set_site_email_domain_receiving tool](https://modulify.ai/docs/mcp/emails/set-site-email-domain-receiving).

## Inputs

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `projectId` | string | Yes | The site id. |
| `domainId` | string | Yes | The id of the email domain, from `emailDomains.items` in `get_site_email_settings`. |
| `enabled` | boolean | Yes | True to turn receiving on, false to turn it off. |

## Response

Every call answers with the [JSON envelope](https://modulify.ai/docs/api/requests-and-responses#the-response) of `success`, `message`, `data`, `code` and `version`. `data` holds the result described above, and on a method that returns a total, `count` carries it. The [response headers](https://modulify.ai/docs/api/requests-and-responses#headers-on-every-method-call) carry the call's `X-Request-Id` and what is left of your per-minute budget in `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`. [Errors](https://modulify.ai/docs/api/errors) explains every status code a call can answer with.