Setting up a custom sending domain improves deliverability and allows you to send from your own email addresses. This guide walks you through the complete DNS configuration process.
Why Use a Custom Domain?
- Better deliverability: Email providers trust authenticated domains
- Brand consistency: Send from
[email protected] instead of a shared domain
- Full control: Manage your sender reputation independently
Prerequisites
- Access to your domain’s DNS settings (usually through your registrar or hosting provider)
- An Ark account with API access
Step 1: Add Your Domain
Python
Node.js
Ruby
Go
cURL
from ark import Ark
client = Ark()
domain = client.domains.create(name="mail.yourdomain.com")
print(f"Domain ID: {domain.data.id}")
print("DNS Records to configure:")
for record in domain.data.dns_records:
print(f" {record.type} {record.name} -> {record.value}")
import Ark from 'ark';
const client = new Ark();
const domain = await client.domains.create({
name: 'mail.yourdomain.com',
});
console.log(`Domain ID: ${domain.data.id}`);
console.log('DNS Records to configure:');
for (const record of domain.data.dnsRecords) {
console.log(` ${record.type} ${record.name} -> ${record.value}`);
}
require "ark_email"
client = ArkEmail::Client.new
domain = client.domains.create(name: "mail.yourdomain.com")
puts "Domain ID: #{domain.data.id}"
puts "DNS Records to configure:"
domain.data.dns_records.each do |record|
puts " #{record.type} #{record.name} -> #{record.value}"
end
client := ark.NewClient()
domain, err := client.Domains.Create(ctx, ark.DomainCreateParams{
Name: ark.String("mail.yourdomain.com"),
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("Domain ID: %s\n", domain.Data.ID)
fmt.Println("DNS Records to configure:")
for _, record := range domain.Data.DNSRecords {
fmt.Printf(" %s %s -> %s\n", record.Type, record.Name, record.Value)
}
curl -X POST https://api.arkhq.io/v1/domains \
-H "Authorization: Bearer $ARK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "mail.yourdomain.com"}'
The response includes the DNS records you need to add:
{
"dnsRecords": [
{
"type": "TXT",
"name": "ark1._domainkey.mail.yourdomain.com",
"value": "v=DKIM1; k=rsa; p=MIGfMA0G...",
"purpose": "DKIM"
},
{
"type": "TXT",
"name": "mail.yourdomain.com",
"value": "v=spf1 include:spf.arkhq.io ~all",
"purpose": "SPF"
},
{
"type": "CNAME",
"name": "ark-verify.mail.yourdomain.com",
"value": "verify.arkhq.io",
"purpose": "Verification"
}
]
}
Add the following records to your DNS provider:
DKIM Record
DKIM cryptographically signs your emails to prove they came from your domain.
| Field | Value |
|---|
| Type | TXT |
| Name | ark1._domainkey.mail.yourdomain.com |
| Value | v=DKIM1; k=rsa; p=MIGfMA0G... (from API response) |
| TTL | 3600 (or default) |
SPF Record
SPF tells receiving servers which IPs are authorized to send email for your domain.
| Field | Value |
|---|
| Type | TXT |
| Name | mail.yourdomain.com |
| Value | v=spf1 include:spf.arkhq.io ~all |
| TTL | 3600 (or default) |
If you already have an SPF record, add include:spf.arkhq.io to your existing record instead of creating a new one. Only one SPF record is allowed per domain.
Verification CNAME
This allows Ark to verify domain ownership.
| Field | Value |
|---|
| Type | CNAME |
| Name | ark-verify.mail.yourdomain.com |
| Value | verify.arkhq.io |
| TTL | 3600 (or default) |
Step 3: Verify Your Domain
After adding DNS records, wait for propagation (can take up to 48 hours, but usually faster) and verify:
Python
Node.js
Ruby
Go
cURL
result = client.domains.verify("dom_abc123")
if result.data.verified:
print("Domain verified successfully!")
else:
print("DNS records not found. Please check your configuration.")
const result = await client.domains.verify('dom_abc123');
if (result.data.verified) {
console.log('Domain verified successfully!');
} else {
console.log('DNS records not found. Please check your configuration.');
}
result = client.domains.verify("dom_abc123")
if result.data.verified
puts "Domain verified successfully!"
else
puts "DNS records not found. Please check your configuration."
end
result, err := client.Domains.Verify(ctx, "dom_abc123")
if err != nil {
log.Fatal(err)
}
if result.Data.Verified {
fmt.Println("Domain verified successfully!")
} else {
fmt.Println("DNS records not found. Please check your configuration.")
}
curl -X POST https://api.arkhq.io/v1/domains/dom_abc123/verify \
-H "Authorization: Bearer $ARK_API_KEY"
Optional: DMARC Configuration
DMARC adds another layer of authentication and tells receiving servers how to handle emails that fail authentication.
Add this TXT record:
| Field | Value |
|---|
| Type | TXT |
| Name | _dmarc.mail.yourdomain.com |
| Value | v=DMARC1; p=none; rua=mailto:[email protected] |
Start with p=none to monitor, then move to p=quarantine or p=reject once you’re confident in your configuration.
Troubleshooting
Verification Failed
- Check DNS propagation: Use dnschecker.org to verify records are visible globally
- Check record values: Ensure you copied the exact values from the API response
- Wait and retry: DNS can take up to 48 hours to propagate fully
SPF Issues
If you have multiple services sending email:
v=spf1 include:spf.arkhq.io include:_spf.google.com include:sendgrid.net ~all
SPF has a 10 DNS lookup limit. If you exceed this, some emails may fail authentication.
Next Steps