Email sending domains
Let your customers authenticate their own domain to send mail from your platform.
If you run an email platform, your customer cannot send as [email protected]
until their domain carries a few DNS records that name you as an allowed sender.
This page shows how to publish those records from your product so the customer
approves a change instead of copying values between two screens.
What a sending domain needs
| Record | What it does |
|---|---|
SPF (TXT) | Names the servers that may send for the domain. A domain has exactly one. |
DKIM (CNAME or TXT) | Signs each message under the customer's domain. |
DMARC (TXT at _dmarc) | Says what receivers do when a message fails, and where reports go. |
Return path (CNAME) | Sends bounces to a host on the customer's domain so SPF lines up with the From address. |
| MX | Only when you also receive mail for the domain. |
Connect the domain
- Create a connection for the sending domain.
- If your records are minted per domain, supply them with
PUT /v1/connections/{id}/records. Hosts are relative to the connection (s1._domainkey,bounce,_dmarc). - Open the widget, or send the customer through the connection's setup. They approve once at their DNS provider, or follow guided steps that turn green as each record appears.
- Listen for
connection.liveand show the domain as verified.
curl -X POST https://api.customdomain.ai/v1/connections \
-H "Authorization: Bearer $CUSTOMDOMAIN_API_KEY" -H "Content-Type: application/json" \
-d '{"domain": "mail.example.com"}'
curl -X PUT https://api.customdomain.ai/v1/connections/{id}/records \
-H "Authorization: Bearer $CUSTOMDOMAIN_API_KEY" -H "Content-Type: application/json" \
-d '{"records": [
{"type": "CNAME", "host": "s1._domainkey", "value": "s1.dkim.yourplatform.example"},
{"type": "CNAME", "host": "bounce", "value": "bounces.yourplatform.example"},
{"type": "TXT", "host": "_dmarc", "value": "v=DMARC1; p=none; rua=mailto:[email protected]"}]}'The PUT is server to server only. Try the whole flow first in the
Sandbox.
One SPF record
A domain with two v=spf1 records fails SPF for all of its mail, not just yours.
Add your sending host with the SPFM record type and it is merged into the
record already published. See Email DNS and SPF merge.
Make SPF and DKIM line up
DMARC only counts a pass when the authenticated domain matches the From domain. Sending from your own bounce domain passes SPF but does not line up. Use a return path host and DKIM keys published under the customer's domain, as in the example above, so at least one of the two lines up.
Mistakes to expect
| Mistake | Result |
|---|---|
| A second SPF record | SPF fails for every sender on the domain |
The domain typed into the host field, s1._domainkey.example.com | The record lands at s1._domainkey.example.com.example.com |
| Quotes pasted into the value | The record does not match |
A DKIM CNAME that is proxied | Receivers cannot read the key |
| Too many SPF includes | SPF errors once the lookup limit is passed |
Starting DMARC at p=none is the safe default. Tighten it once legitimate mail
passes.