infrastructure.
- Domain Listing: Follows the domain regardless of the sending IP. Indicates issues with content, list hygiene, or domain reputation history.
2. Authentication Audit
Before querying blacklists, verify that your DNS authentication records are correctly configured. Missing or misconfigured records can trigger heuristic filtering that mimics blacklisting.
TypeScript Utility for DNS Authentication Verification
Use this script to programmatically validate SPF, DKIM, and DMARC records. This ensures your infrastructure meets baseline requirements before reputation recovery.
import * as dns from 'dns/promises';
interface AuthVerificationResult {
domain: string;
spf: { valid: boolean; record?: string; error?: string };
dkim: { valid: boolean; selector: string; record?: string; error?: string };
dmarc: { valid: boolean; policy: string; record?: string; error?: string };
}
export async function verifyEmailAuth(domain: string, dkimSelector: string): Promise<AuthVerificationResult> {
const result: AuthVerificationResult = {
domain,
spf: { valid: false },
dkim: { valid: false, selector: dkimSelector },
dmarc: { valid: false, policy: 'none' },
};
try {
// Check SPF
const spfRecords = await dns.resolveTxt(domain);
const spfRecord = spfRecords.find(r => r[0]?.startsWith('v=spf1'));
if (spfRecord) {
result.spf.valid = true;
result.spf.record = spfRecord[0];
} else {
result.spf.error = 'SPF record not found';
}
// Check DKIM
const dkimQuery = `${dkimSelector}._domainkey.${domain}`;
try {
const dkimRecords = await dns.resolveTxt(dkimQuery);
result.dkim.valid = true;
result.dkim.record = dkimRecords[0].join('');
} catch {
result.dkim.error = 'DKIM record not found for selector';
}
// Check DMARC
const dmarcQuery = `_dmarc.${domain}`;
try {
const dmarcRecords = await dns.resolveTxt(dmarcQuery);
const dmarcRecord = dmarcRecords[0].join('');
result.dmarc.valid = true;
result.dmarc.record = dmarcRecord;
// Extract policy
const policyMatch = dmarcRecord.match(/p=([^;]+)/);
if (policyMatch) {
result.dmarc.policy = policyMatch[1];
}
} catch {
result.dmarc.error = 'DMARC record not found';
}
} catch (err) {
console.error('DNS resolution failed:', err);
}
return result;
}
Architecture Rationale:
- Programmatic Verification: Automating DNS checks prevents configuration drift. Integrate this into your CI/CD pipeline or deployment hooks.
- Selector Abstraction: DKIM selectors vary by provider. The utility accepts a selector parameter to support multi-tenant or rotating key strategies.
- Policy Extraction: DMARC policy (
p=none, quarantine, reject) is critical. Production systems should eventually enforce quarantine or reject to prevent spoofing.
3. Blacklist Querying Strategy
Prioritize queries based on the authority matrix.
- Spamhaus Lookup: Query
spamhaus.org/lookup for both IP and domain. This is the highest priority check.
- Barracuda Lookup: Query
barracudacentral.org/lookups if enterprise deliverability is a concern.
- Broad Sweep: Use aggregators like MXToolbox to scan ~100 lists simultaneously. This identifies obscure listings that may affect niche providers.
4. Root Cause Analysis
Blacklists provide reason codes or descriptions upon lookup. Analyze these to determine the trigger:
- Spam Complaints: Review your email service provider (ESP) logs for complaint rates. If >0.1%, you must purge unengaged contacts immediately.
- Spam Traps: Honeypot addresses indicate list hygiene failures. If triggered, stop sending to the affected segment and implement double opt-in.
- Volume Spikes: New domains sending high volume instantly trigger heuristic filters.
- Shared IP Contamination: If the IP is listed but your domain is clean, the issue is likely a neighbor. Contact your hosting provider to migrate to a clean IP.
Do not request delisting until the root cause is resolved. Premature requests can lead to relisting or permanent bans.
- Halt Sending: Pause outbound mail to prevent further reputation damage.
- Fix Infrastructure: Resolve authentication errors, remove spam traps, and clean lists.
- Wait Period: Allow 24β48 hours for systems to register the cleanup. Some lists require a "cooling off" period.
- Submit Removal Request: Use the official removal portal for each list. Provide a concise explanation of the issue and the steps taken to resolve it.
- Monitor: Verify delisting and gradually resume sending with strict monitoring.
Pitfall Guide
| Pitfall | Explanation | Fix |
|---|
| Premature Delisting Requests | Requesting removal before fixing the cause results in immediate relisting. Repeated requests may flag your IP for manual review or permanent blocking. | Always resolve the root cause, wait 24 hours, and verify logs are clean before submitting a removal request. |
| Ignoring Shared IP Risks | On shared hosting, one tenant's abuse can blacklist the entire IP block. Developers often assume their domain is safe because their code is clean. | Monitor IP reputation separately from domain reputation. If listed due to neighbors, migrate to a dedicated IP or switch providers. |
| Spam Trap Neglect | Spam traps are inactive addresses used to detect poor list hygiene. Sending to them indicates purchased or scraped lists. | Implement double opt-in for all new subscribers. Never use purchased lists. Regularly scrub inactive contacts. |
| Volume Shock on New Domains | New domains have no reputation. Sending high volume immediately triggers spam filters and can lead to blacklisting. | Implement a graduated warm-up schedule. Start with 20β50 emails per day and scale volume incrementally over 4β6 weeks. |
| Complaint Rate Blindness | Teams often ignore complaint rates until deliverability collapses. Gmail filters aggressively above 0.1%. | Set up alerts for complaint rates. Maintain rates below 0.08%. Automatically suppress users who mark emails as spam. |
| Incomplete DMARC Policy | Running DMARC in none mode indefinitely leaves the domain vulnerable to spoofing, which can damage reputation. | Progress DMARC policy from none to quarantine and eventually reject once authentication is stable. |
| Purchased List Usage | Purchased lists contain high rates of spam traps and unengaged users, guaranteeing reputation damage. | Build organic lists only. Use verified opt-in mechanisms. Delete any existing purchased data immediately. |
Production Bundle
Action Checklist
Decision Matrix
| Scenario | Recommended Approach | Why | Cost Impact |
|---|
| Enterprise High Volume | Dedicated IP + Premium ESP | Isolates reputation; provides granular control and support. | High |
| Startup / MVP | Shared IP + Reputable ESP | Lower cost; ESP manages warm-up and reputation pooling. | Low |
| Recovering from Listing | Dedicated IP + Strict Auth | Breaks association with tainted IP; accelerates recovery. | Medium |
| Transactional Mail | Separate IP/Domain from Marketing | Prevents marketing reputation issues from affecting critical alerts. | Medium |
| Shared Hosting User | Migrate to VPS or Managed ESP | Eliminates neighbor risk; provides dedicated resources. | Medium |
Configuration Template
Use these templates as a baseline for DNS configuration. Adjust values based on your email service provider.
SPF Record:
v=spf1 include:_spf.google.com include:sendgrid.net ~all
Note: Include only authorized sending services. Use ~all (soft fail) during testing; move to -all (hard fail) in production.
DKIM Record:
v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC...
Note: Generated by your ESP. Ensure the selector matches your code configuration.
DMARC Record:
v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@yourdomain.com; ruf=mailto:forensics@yourdomain.com; pct=100; adkim=s; aspf=s
Note: Start with p=none to monitor reports. Move to p=quarantine after 2β4 weeks of clean data. adkim=s and aspf=s enforce strict alignment.
Quick Start Guide
- Run Authentication Check: Execute the TypeScript verification script against your domain. Fix any missing or invalid records immediately.
- Query Spamhaus: Visit
spamhaus.org/lookup and enter your sending IP and domain. Note any listings and reason codes.
- Pause and Analyze: If listed, halt sending. Review logs for complaint spikes, spam traps, or volume anomalies.
- Remediate and Request: Fix the root cause, wait 24 hours, then submit removal requests via official portals.
- Resume with Monitoring: Restart sending at low volume. Monitor complaint rates and blacklist status daily for the first week.