Domains
Add and verify your domains to send emails with your own sender identity.
Why Verify Domains?
Domain verification improves email deliverability and protects your brand:
- Better deliverability - Verified domains have higher inbox placement rates
- Brand protection - DKIM signing prevents email spoofing
- Professional appearance - Send from your own domain, not a shared sender
Add a Domain
Register a domain for verification.
POST /v1/domainsadd-domain.ts
const domain = await client.domains.create({
domain: 'mail.example.com',
});
console.log(domain.status); // 'pending'
console.log(domain.dnsRecords); // DNS records to configureDNS Configuration
After adding a domain, you will receive DNS records to configure. Add these records to your DNS provider:
Required Records
| Type | Host | Value | Purpose |
|---|---|---|---|
| TXT | v=spf1 include:spf.veilmail.xyz ~all | SPF (sender verification) | |
| TXT | veilmail._domainkey | k=rsa; p=MIGfMA0GCS... | DKIM (signing) |
| CNAME | bounce | bounce.veilmail.xyz | Bounce handling |
DNS Propagation
DNS changes can take up to 48 hours to propagate. Most changes are visible within a few minutes to a few hours.
Verify Domain
After configuring DNS records, trigger verification to check the setup.
POST /v1/domains/:id/verifyverify-domain.ts
const domain = await client.domains.verify('domain_xxxxx');
if (domain.status === 'verified') {
console.log('Domain verified successfully!');
} else {
// Check which records are still pending
for (const record of domain.dnsRecords) {
console.log(`${record.type} ${record.host}: ${record.status}`);
}
}Domain Status
| Status | Description |
|---|---|
pending | DNS records not yet verified |
verified | All DNS records verified, ready to send |
failed | Verification failed (records may be incorrect) |
List Domains
GET /v1/domainslist-domains.ts
const { data } = await client.domains.list();
for (const domain of data) {
console.log(`${domain.domain}: ${domain.status}`);
}Delete Domain
DELETE /v1/domains/:iddelete-domain.ts
await client.domains.delete('domain_xxxxx');