analytics

code Python verified Free Download devices Cross-platform

code Code Preview

Python
#!/usr/bin/env python3
"""
Email Deliverability Report Generator
Comprehensive analysis of email authentication
"""
import dns.resolver

def check_spf(domain):
    """Check SPF record"""
    try:
        records = dns.resolver.resolve(domain, 'TXT')
        for r in records:
            txt = ''.join([s.decode() for s in r.strings])
            if txt.startswith('v=spf1'):
                return {'status': 'PASS', 'record': txt}
        return {'status': 'FAIL', 'error': 'No SPF record'}
    except Exception as e:
        return {'status': 'ERROR', 'error': str(e)}

def check_dmarc(domain):
    """Check DMARC record"""
    try:
        records = dns.resolver.resolve(f'_dmarc.{domain}', 'TXT')
        for r in records:
            txt = ''.join([s.decode() for s in r.strings])
            if txt.startswith('v=DMARC1'):
                return {'status': 'PASS', 'record': txt}
        return {'status': 'FAIL', 'error': 'No DMARC record'}
    except Exception as e:
        return {'status': 'ERROR', 'error': str(e)}

def check_mx(domain):
    """Check MX records"""
    try:
        records = dns.resolver.resolve(domain, 'MX')
        mx_list = [(r.preference, str(r.exchange)) for r in records]
        return {'status': 'PASS', 'records': mx_list}
    except Exception as e:
        return {'status': 'FAIL', 'error': str(e)}

def generate_report(domain):
    """Generate full deliverability report"""
    return {
        'domain': domain,
        'spf': check_spf(domain),
        'dmarc': check_dmarc(domain),
        'mx': check_mx(domain)
    }

if __name__ == '__main__':
    domain = input('Enter domain: ')
    report = generate_report(domain)
    print(f"SPF: {report['spf']['status']}")
    print(f"DMARC: {report['dmarc']['status']}")
    print(f"MX: {report['mx']['status']}")

info About This Tool

The Deliverability Report Generator creates comprehensive email health reports by analyzing SPF, DKIM, DMARC records, and MX configuration. Get actionable insights to improve your email deliverability.

Checks Performed

  • SPF Analysis - Validates Sender Policy Framework record and DNS lookup count
  • DKIM Check - Verifies DKIM selector and public key presence
  • DMARC Validation - Analyzes policy settings and report addresses
  • MX Records - Checks mail server configuration and priority
  • Blacklist Scan - Queries major blacklist services

Report Output

  • Overall deliverability score (0-100)
  • Pass/Fail status for each check
  • Specific issues found
  • Recommendations for improvement
  • HTML and JSON export options

Requirements

  • Python 3.7+
  • dnspython (pip install dnspython)

Use Case: Run this report weekly to monitor your domain's email health and catch issues before they impact deliverability.

download Download Script

Need Full Automation?

Try Postigo for automated email campaigns with AI personalization

rocket_launch Start Free Trial