Domain Setup
3 min read
Before sending emails in production, you need to verify your domain. This proves you own the domain and allows email servers to trust your messages.
Why domain verification matters
Without verification:
- Emails may land in spam
- Some providers reject messages entirely
- You can’t use your own branding
- Deliverability is unpredictable
With verification:
- SPF, DKIM, DMARC authenticate your emails
- Higher inbox placement rates
- Professional sender reputation
- Full control over your email identity
Adding a domain
Via Dashboard
- Go to Settings → Domains
- Click Add domain
-
Enter your domain (e.g.,
notifications.yourdomain.com) - Click Add
Via API
curl -X POST https://api.mailingapi.com/v1/domains \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"domain": "notifications.yourdomain.com"}'
Response:
{
"id": "dom_abc123",
"domain": "notifications.yourdomain.com",
"status": "pending",
"dns_records": [...]
}
Choosing your domain
Use a subdomain
We recommend using a subdomain rather than your root domain:
✓ mail.yourdomain.com
✓ notifications.yourdomain.com
✓ alerts.yourdomain.com
✗ yourdomain.com (not recommended)
Why?
- Isolates email reputation from your website
- Easier to manage DNS records
- Separate domains for transactional vs. marketing
Naming conventions
| Use case | Example |
|---|---|
| Transactional emails |
mail.yourdomain.com |
| Notifications |
notifications.yourdomain.com |
| Alerts |
alerts.yourdomain.com |
| Marketing (separate) |
news.yourdomain.com |
DNS records
After adding a domain, you’ll receive DNS records to configure:
1. SPF Record
SPF tells email servers which IPs can send email from your domain.
Type: TXT
Host: notifications.yourdomain.com
Value: v=spf1 include:spf.mailingapi.com ~all
If you already have an SPF record, add our include:
v=spf1 include:_spf.google.com include:spf.mailingapi.com ~all
Important: You can only have one SPF record per domain.
2. DKIM Record
DKIM signs your emails cryptographically, proving they weren’t tampered with.
Type: CNAME
Host: mlapi._domainkey.notifications.yourdomain.com
Value: mlapi._domainkey.mailingapi.com
We manage key rotation automatically when you use CNAME.
3. DMARC Record
DMARC tells receivers what to do with emails that fail SPF/DKIM.
Type: TXT
Host: _dmarc.notifications.yourdomain.com
Value: v=DMARC1; p=quarantine; rua=mailto:dmarc@yourdomain.com
DMARC policies:
-
p=none— Monitor only, no action -
p=quarantine— Send failures to spam -
p=reject— Reject failures entirely
Start with p=none, then tighten after confirming everything works.
4. Ownership verification
A TXT record proving you control this domain:
Type: TXT
Host: _mailingapi.notifications.yourdomain.com
Value: mailingapi-verify=abc123xyz
Getting DNS records
Via Dashboard
Go to Settings → Domains → [Your Domain] → DNS Records
Via API
curl https://api.mailingapi.com/v1/domains/dom_abc123/dns-records \
-H "Authorization: Bearer $API_KEY"
Response:
{
"records": [
{
"type": "TXT",
"host": "notifications.yourdomain.com",
"value": "v=spf1 include:spf.mailingapi.com ~all",
"purpose": "spf"
},
{
"type": "CNAME",
"host": "mlapi._domainkey.notifications.yourdomain.com",
"value": "mlapi._domainkey.mailingapi.com",
"purpose": "dkim"
}
]
}
Adding records to your DNS
The process varies by provider. Here are common ones:
Cloudflare
- Go to DNS settings
- Click Add record
- Select record type (TXT or CNAME)
- Enter name and value
- Save (proxy OFF for email records)
AWS Route 53
- Go to Hosted zones → Your domain
- Click Create record
- Enter record details
- Click Create records
GoDaddy
- Go to DNS Management
- Click Add
- Select record type
- Enter host and value
- Save
Note: DNS changes can take up to 48 hours to propagate, though usually it’s much faster.
Verifying your domain
After adding DNS records:
Via Dashboard
- Go to Settings → Domains → [Your Domain]
- Click Verify
- Wait for verification (usually seconds to minutes)
Via API
curl -X POST https://api.mailingapi.com/v1/domains/dom_abc123/verify \
-H "Authorization: Bearer $API_KEY"
Response:
{
"status": "verified",
"spf": {"status": "valid"},
"dkim": {"status": "valid"},
"dmarc": {"status": "valid"},
"ownership": {"status": "valid"}
}
Verification statuses
| Status | Meaning |
|---|---|
pending |
DNS records not yet checked |
verifying |
Verification in progress |
verified |
All records valid, ready to send |
failed |
One or more records invalid |
If verification fails, check the response for specific errors:
{
"status": "failed",
"spf": {"status": "valid"},
"dkim": {"status": "missing", "error": "CNAME record not found"},
"dmarc": {"status": "valid"},
"ownership": {"status": "valid"}
}
Troubleshooting
“SPF record not found”
- Verify the TXT record exists at the correct host
- Check for typos in the value
- Wait for DNS propagation
“Too many DNS lookups”
SPF has a limit of 10 DNS lookups. If you’re over:
- Remove unused includes
- Use IP addresses directly for static servers
- Consider SPF flattening
“DKIM signature mismatch”
-
Ensure CNAME points to exactly
mlapi._domainkey.mailingapi.com -
Check the host is
mlapi._domainkey.yourdomain.com - Remove any trailing dots
“DMARC not aligned”
- Ensure SPF and DKIM domains match your From address
-
Check DMARC policy allows subdomains (
sp=tag)
Multiple domains
You can add multiple domains to your account:
curl -X POST https://api.mailingapi.com/v1/domains \
-H "Authorization: Bearer $API_KEY" \
-d '{"domain": "alerts.yourdomain.com"}'
Each domain:
- Requires separate verification
- Gets its own API keys
- Has independent reputation
Use cases:
- Different products/brands
- Separate transactional from marketing
- Regional domains
Best practices
- Use subdomains — Don’t risk your root domain reputation
-
Start with monitoring DMARC — Use
p=noneinitially - Check records regularly — DNS can change or expire
- Monitor deliverability — Use our dashboard analytics
- Separate email types — Different domains for different purposes
Next steps
- Configure webhooks for delivery notifications
- Create templates for consistent emails
- Set up validation to clean your lists