---
name: email-domain-setup
description: Set up a notification.dev sending domain through MCP, collect the domain name, return copyable DNS records or publish them through a connected DNS provider, and check verification. Use for email sender domain setup, not email composition or sending.
---

# Email domain setup

Read `notification-platform` for project selection and permissions. The domain
tools configure the same sending domains shown in **Settings → Email**. They do
not send email or change DNS themselves. AWS credentials are managed by the
platform; do not ask the user for them.

## Tools

| Tool                  | Arguments               | Access                            | Result                                                                 |
| --------------------- | ----------------------- | --------------------------------- | ---------------------------------------------------------------------- |
| `list_email_domains`  | `projectId`             | `project:read`                    | Existing domains, IDs, status and DNS records in `items`.              |
| `create_email_domain` | `projectId`, `domain`   | `credentials:manage`, owner/admin | Domain ID, status and `dnsRecords` containing `type`, `name`, `value`. |
| `verify_email_domain` | `projectId`, `domainId` | `credentials:manage`, owner/admin | Refreshed domain status and DNS records.                               |

Connections missing these permissions need reauthorization. An unavailable
email service or rejected platform authentication is an operator configuration
problem; explain it rather than requesting customer AWS keys.

## Guided workflow

1. Select an approved project with `list_projects`. Ask for the sending domain
   if it was not supplied, such as `mail.example.com`. Ask for the domain itself,
   without a URL scheme, path or email address. Do not silently choose a different
   domain or subdomain.
2. Call `list_email_domains` before writing. Reuse an existing domain's ID. For
   a new domain, call `create_email_domain`; the user's setup request authorizes
   registration. It returns the actual provider-generated DNS records. Never
   invent DKIM tokens, ownership proofs or record values. On an ambiguous timeout,
   list domains before retrying; registration of the same domain reuses its ID
   and proof. If a saved domain has no records, use `verify_email_domain` to retry
   provider setup and fetch them. A domain claimed by another project requires
   resolving that conflict, not deleting the other project's domain.
3. Present the records as a table with **Type**, **Name**, **Value** and
   **Priority**, with each name and value separately copyable. An MX record's
   returned value contains its numeric priority followed by the mail server:
   split those into Priority and Value when showing or publishing it. Leave
   CNAME targets and TXT values exactly as returned.
4. Offer manual DNS entry or setup through an available DNS provider MCP. Ask
   which route the user prefers when it is unknown; reuse authorization already
   given to publish these records. If no DNS provider tools are connected, return
   the records for manual entry without blocking setup on a new connection.
5. For manual entry, explain that **Name** may be a full name or relative to the
   zone. Ask for the managed DNS zone if needed; do not infer it by removing the
   first label or taking the last two labels. For zone `example.com`,
   `token._domainkey.mail.example.com` becomes `token._domainkey.mail` and
   `bounce.mail.example.com` becomes `bounce.mail`. Remove only the exact zone
   suffix from names, use `@` at the zone apex, and never shorten values.
6. When publishing through DNS provider tools, inspect their schemas and list
   zones and existing records first. Match the user's domain to the intended
   managed zone, asking if several could apply. Follow that provider's full-name
   or relative-name convention and supply MX priority separately. Skip identical
   records. Preserve unrelated records, root MX, existing SPF and DMARC policies,
   and ownership TXT values from other environments. Add this ownership proof
   alongside existing TXT values. If a required CNAME/MX/SPF conflicts with an
   existing record, show the conflict and ask before replacing or merging it.
   Do not delete records or switch nameservers to complete this workflow.
7. After the user confirms manual entry or provider tools report successful
   publication, call `verify_email_domain`. Report its actual status: DNS saved
   does not mean verified. If pending, explain propagation and offer a later
   recheck rather than tight polling. If failed, show the returned records and
   identify the failing check only when evidence supports it.

## Sender defaults and provider readiness

After verification, read `get_email_setup` and `list_email_senders`. Reuse a saved
sender on the verified domain; create one with `create_email_sender` only when the
user requested sender setup. `input` contains `domainId`, `name`, `address`,
optional `replyTo`, and `isDefault`. Owner/admin and `project:write` are required.
Use `update_email_setup` for the postal address and default reply-to. Changing
these defaults does not rewrite already-dispatched messages.

Call `get_email_provider_status` before declaring sending ready. `available:false`
is an unavailable or unconfigured provider, never a healthy result. Report the
actual `productionAccess`, `sendingEnabled`, `tenantSendingStatus` and quotas.
Sandbox mode permits only verified recipients and SES simulator addresses; a
verified sending domain does not remove that restriction. Never ask customers
for AWS keys or claim production access from a runtime activation flag.

`list_email_suppressions` requires `subscribers:read`; manual add and removal
require owner/admin and `project:write`. Removal requires explicit user review,
affects only this project/tenant, and never restores subscriber opt-in. Do not
remove a bounce or complaint suppression merely to make a campaign send.
`get_email_deliverability` requires `reports:read` and returns observed retained
recipient cohorts; it is not an inbox-placement guarantee.

## Completion

Report the sending domain, domain ID and verification status. A verified sender
address must use that exact domain, for example `news@mail.example.com` for
`mail.example.com`. Verification alone does not establish that a mailbox exists.
Email sending also needs the sender's postal address in **Settings → Email** and
is subject to the platform's sending restrictions. Do not send a test message,
create a campaign or activate a Journey unless the user requests that work.
