---
title: "corestack_email_apply_dns"
url: https://docs.corefinity.com/mcp/tools/corestack_email_apply_dns
type: tool
last_updated: 2026-11-13
feature: email
related:
  - https://docs.corefinity.com/api/reference/site-settings/create-site-email-dns-records.md
  - https://docs.corefinity.com/guides/sites/site-settings/outbound-email.md
---
# corestack_email_apply_dns

**Add a sending domain's DNS records.** Add a row's sending domain records (SPF, DKIM, tracking) to its Cloudflare zone while the domain waits for DNS. Inbound MX records are left alone unless mx is true. Scope: write.

- Scope: `write`
- Runs as a task: no

## When to use it

Add a row's sending domain records (SPF, DKIM, tracking) to its Cloudflare zone while the domain waits for DNS. Inbound MX records are left alone unless mx is true.

## Inputs

- `site_id` (integer, ≥ 1, required)
- `sending_domain` (string, up to 253 characters): The default when omitted.
- `mx` (boolean, default `false`): Also write Mailgun's inbound MX records, replacing the domain's mail routing.

### Input schema

```json
{
  "additionalProperties": false,
  "properties": {
    "mx": {
      "default": false,
      "description": "Also write Mailgun's inbound MX records, replacing the domain's mail routing.",
      "type": "boolean"
    },
    "sending_domain": {
      "description": "The default when omitted.",
      "maxLength": 253,
      "type": "string"
    },
    "site_id": {
      "minimum": 1,
      "type": "integer"
    }
  },
  "required": [
    "site_id"
  ],
  "type": "object"
}
```

## Refusals

- `state`: the object is not in a state this applies to; read it again.
- `not_connected`: no Cloudflare connection can write this zone; connect Cloudflare or point DNS by hand.
- `no_zone`: the domain's DNS zone is not in the connected Cloudflare account; point DNS by hand.
- `managed_elsewhere` (message: "This site is managed by another control panel"): another control panel manages this site, so use that control panel for it. This is refused before anything else about the site, as in the Control Panel and the API. Nothing was done.
- The refusals every tool can answer: `invalid_arguments`, `tenant_mismatch`, `scope_required`, `pin_refused`, `rate_limited`, `temporarily_unavailable`, `internal_error` (corestack://guides/how-this-server-works).

## Example

```json
{
  "name": "corestack_email_apply_dns",
  "arguments": {
    "site_id": 4211
  }
}
```

## Prompt

```text
Using the Corefinity MCP server, call corestack_email_apply_dns with site_id 4211. (Add a sending domain's DNS records.) Tell me what it returned.
```

## The same task elsewhere

- Endpoint: [POST /api/corestack/sites/{site}/email/dns](https://docs.corefinity.com/api/reference/site-settings/create-site-email-dns-records.md)
- Guide: [Outbound email](https://docs.corefinity.com/guides/sites/site-settings/outbound-email.md)
