Skip to content
Back to skills

Setting Up An Email Domain

ASecurity

Set up a custom sending domain for PostHog Workflows email end to end: create the email sender, get its DNS records, publish them through Domain Connect or your own DNS tools, and verify until the domain can send. Use when asked to set up, connect, verify, or fix an email sender or sending domain for workflows, broadcasts, or campaigns, or when DNS records for SPF, DKIM, DMARC, or MAIL FROM are missing.

  • 81 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added November 29, 2026
content-marketinggoapi

Works with

  • cli
  • api
  • mcp

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned November 29, 2026

npx -y skills add PostHog/skills --skill setting-up-an-email-domain --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Setting Up An Email Domain?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Setting Up An Email Domain
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/posthog-setting-up-an-email-domain/badge)](https://www.skillsdirectory.com/skills/posthog-setting-up-an-email-domain)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: setting-up-an-email-domain
description: 'Set up a custom sending domain for PostHog Workflows email end to end: create the email sender, get its DNS records, publish them through Domain Connect or your own DNS tools, and verify until the domain can send. Use when asked to set up, connect, verify, or fix an email sender or sending domain for workflows, broadcasts, or campaigns, or when DNS records for SPF, DKIM, DMARC, or MAIL FROM are missing.'
---

# Setting up an email domain

Workflows sends email from the customer's own domain.
A sender (`hello@mail.example.com`) cannot send until its domain is verified, and verification needs DNS records the customer publishes at their DNS host.
Your job is to get from "I want to send email" to a verified sender with as little work for the person as possible.

## Tools

The update and both Domain Connect tools exist only when the project has the email from code feature enabled.
Without them, publish the records by hand, and tell the person to rename the sender or change its MAIL FROM in PostHog.
If `integrations-email-create` or `integrations-email-status-retrieve` is missing, stop and tell the person the tools are not available to them yet.
Do not fall back to `integrations-create` or other integration tools.

| Step                     | Tool                                           |
| ------------------------ | ---------------------------------------------- |
| Find existing senders    | `integrations-list` with `kind=email`          |
| Create the sender        | `integrations-email-create`                    |
| Get records, poll them   | `integrations-email-status-retrieve`           |
| Mark the sender verified | `integrations-email-verify-create`             |
| One-click DNS support?   | `integrations-domain-connect-check-retrieve`   |
| One-click DNS URL        | `integrations-domain-connect-apply-url-create` |
| Rename, change MAIL FROM | `integrations-email-partial-update`            |

Listing, reading the status, checking and creating need project membership.
Verifying, updating and the Domain Connect URL need project admin access, so a member can create a sender but not verify it.
A 403 with "You don't have sufficient permissions in the project" means the person must ask a project admin; do not retry.
A 403 with "This action is not available to API keys or OAuth tokens in this project" means the feature is off for this project: do not retry, publish the records by hand, and tell the person they can finish the step in PostHog.

## Workflow

### 1. Pick the domain and the sender

Ask which domain to send from if the person has not said.
Recommend the `mail.` subdomain, for example `mail.example.com`, or `send.example.com` if `mail.` is taken: it keeps marketing reputation and DMARC changes away from the root domain the company uses for everyday mail.
Accept the root domain if they prefer it.

If they only give a domain, default the sender to `hello@<domain>` with the company name as the display name.
Tell them the display name can change later, but the address cannot: a different address needs a new sender.
Free mailbox domains such as gmail.com are rejected, and so is a domain another PostHog organization has already verified; relay that error and suggest contacting support for the second case.
If another organization has only started setting up the domain, the records of your sender include an `organization` TXT record that proves your organization owns the domain.

Check `integrations-list` with `kind=email` first; each sender's `display_name` is its address.
If a sender with the exact requested address exists, skip to step 3 with its `id`.
Never create it again: creating a sender for an address that already has one fails.

### 2. Create the sender

Call `integrations-email-create` with `config.email` and `config.name`.
The provider defaults to `ses`.
The MAIL FROM subdomain belongs to the whole domain, not to one sender: creating a sender sets it for every sender on that domain.

- When the domain already has a sender, the new sender keeps the domain's MAIL FROM subdomain whatever you pass, and the response carries the value that applies. Leave `mail_from_subdomain` out.
- On a new domain, leave `mail_from_subdomain` at its default `feedback`. Pick another label such as `bounce` only if `feedback.<domain>` already has an MX record that does not point at `amazonses.com`, for example from another email tool.

Pass the returned `id` as `id` to the status, verify and update tools, and as `integration_id` to `integrations-domain-connect-apply-url-create`.

### 3. Get the records

Call `integrations-email-status-retrieve` with `refresh=true`.
It returns the overall `status`, the setup `steps` and `records`; each record has a `kind`, a fully qualified `hostname`, a `type`, a `value`, an MX `priority` and its own `status`.
A record with status `found` or `verified` is already in place. Publish every record that is still `pending`.

If `status` is `not_started`, the email provider has no setup for this domain yet and `records` is empty.
Polling does not change that, so call `integrations-email-verify-create` once to start the setup, then call `integrations-email-status-retrieve` with `refresh=true` again to get the records.
If verifying returns the project admin permission error, ask a project admin to verify the sender.

### 4. Publish the records

Pick the first path that works:

1. **Domain Connect (the person approves at their DNS host).**
   Call `integrations-domain-connect-check-retrieve` with the sending domain.
   If `supported` is true, call `integrations-domain-connect-apply-url-create` with the `integration_id`.
   You cannot approve it yourself. Give the URL to the person and say what will happen: they sign in at their DNS host (for example Cloudflare), review the records and approve. Nothing changes until they approve.
   When PostHog confirms that neither the sending domain nor its organizational domain, such as `example.com` for `mail.tx.example.com`, has a `_dmarc` record, the URL also adds the default policy `v=DMARC1; p=none;`: tell the person before they approve. Otherwise it leaves DMARC out and keeps the existing policy.
   The URL never adds an `organization` TXT record. After the person approves, call `integrations-email-status-retrieve` with `refresh=true`.
   Publish any record other than DMARC that is still `pending`, such as an `organization` TXT record, through path 2 or 3, but first confirm at the DNS host that the record is missing.
   A lookup can lag behind the approval, and a second SPF record breaks SPF.
2. **Your own DNS tools.**
   If you can manage the domain's DNS (a DNS provider MCP server, CLI or API you are authorized to use), add the missing records yourself.
   Read [references/publishing-records.md](references/publishing-records.md) first: it covers the records that must be merged, not duplicated.
3. **Hand the records to the person.**
   List the records that are still `pending`, as a table with type, name, value and priority.
   Leave DMARC out of the table and handle it as the paragraph after this list says.
   For each SPF record, look up the existing `v=spf1` record at that name.
   If one exists, give the one merged value to replace it with, as [references/publishing-records.md](references/publishing-records.md) describes.
   If you cannot read it, ask the person for its current value first.
   Tell them to edit that record, never to add a second one.
   Mention that many DNS hosts append the domain to the name field, so they enter `_amazonses.mail` rather than `_amazonses.mail.example.com` when the zone is `example.com`.

DMARC is the domain owner's policy, so never add, change or delete a `_dmarc` record yourself, on any path.
If the DMARC record shows as `verified`, the domain already has a policy; keep it.
If it is `pending`, tell the person and let them decide: give them the suggested record, and the `_dmarc` records you can see at the sending domain and every parent up to its organizational domain, such as `_dmarc.tx.example.com` and `_dmarc.example.com` for `mail.tx.example.com`.
Tell them to add the suggested record only after they confirm at their DNS host that the sending domain has no `v=DMARC1` record, since a second policy at the same name makes receivers ignore both, and that a policy at a parent name is one they want to replace for this sender.
If the sending domain has a `_dmarc` record PostHog cannot read, name that record and leave the repair and the policy choice to them.
A `pending` DMARC record can mean no policy exists, the lookup timed out, or an existing record has a form PostHog cannot read, such as no `p=` tag right after `v=DMARC1;`.

### 5. Poll, then verify once

Call `integrations-email-status-retrieve` with `refresh=true` after the records are published, then repeat with at least a minute between calls.

- `pending`: a record is still missing from DNS. Compare the per-record statuses with what was published. DNS usually appears within minutes but can take up to 72 hours.
- `records_found`: every record is published and the email provider has not confirmed them yet. Keep polling.
- `temporary_failure`: the email provider could not check the records yet. Compare the per-record statuses with what was published, then keep polling.
- `failed`: the provider stopped checking. Fix the records, then call `integrations-email-verify-create` to restart the check.
- `verified`: call `integrations-email-verify-create` once. When it returns `success`, every sender on this domain in the project can send.

After about 15 minutes without `verified`, stop polling and call `integrations-email-verify-create` once, since it also starts any setup the email provider is missing, such as DKIM.
If it returns `success`, the sender can send. Call `integrations-email-status-retrieve` with `refresh=true` once more, publish any record other than DMARC it still lists as `pending`, and name it to the person, then go to step 6.
Otherwise call `integrations-email-status-retrieve` with `refresh=true` and publish any record other than DMARC it lists as `pending`, as in step 4; leave a `pending` DMARC record to the person, as step 4 says.
Then tell the person the sender is not verified yet: name each record still `pending` and the exact name it must be published at, since a record under the wrong name never resolves, and say they can ask you to check again later or verify the sender in PostHog.

### 6. Wrap up

Confirm the sender address and display name, and that it now appears as a sender option in workflows and broadcasts.
If the person wants another address on the same domain, create it with `integrations-email-create`, which keeps the domain's MAIL FROM subdomain, then call `integrations-email-verify-create` once for it.
The records are already in place, so it succeeds without new DNS work.

## Changing a sender

Use `integrations-email-partial-update` to change the display name, the reply-to address or the MAIL FROM subdomain.
Send the full config with the current `email`, which cannot change, and the current `name` unless you are renaming the sender.
No read tool returns the name: take it from the `integrations-email-create` response if you created the sender, otherwise ask the person.
A new `mail_from_subdomain` applies to every sender on the domain and needs new MX and SPF records at the new name, so confirm it with the person first, then run steps 3 to 5 again.
To change the address itself, create a new sender.

Files in this skill

  • SKILL.md11.3 KB
  • references/publishing-records.md3.1 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in content-marketing →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.