# set_site_email_forwarding

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

Turns the forwarding of incoming mail on or off for a site, which is on by default for every site.

- Title: Turn the email forwarding of a site on or off
- Scope: `config:write`
- Access: Destructive
- Endpoint: `POST /v1/set_site_email_forwarding`

While it is on, mail sent to any address at the site's built-in sending domain, and at each of its email domains with receiving on, goes to the site's confirmed forwarding addresses (`forwarding.recipients` in `get_site_email_settings`).

While it is off, that mail is accepted and dropped without a bounce, mail still waiting to be forwarded is dropped too, and none of it is forwarded later, so the tool tells the client to confirm with you before turning it off. Turning it on is refused with `Email forwarding is not set up on this server yet!` while `forwarding.available` is false, and turning it off always works.

It needs the **Delete projects** permission. See [Turn forwarding off and on](https://modulify.ai/docs/automations/emails#turn-forwarding-off-and-on).

## Request

Call it with a `POST` to `https://api.modulify.ai/v1/set_site_email_forwarding`, 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_forwarding \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"projectId":"PROJECT_ID","enabled":true}'
```

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

## Inputs

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `projectId` | string | Yes | The site id. |
| `enabled` | boolean | Yes | True to turn forwarding 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.