key
code
Python
verified
Free Download
devices
Cross-platform
code Code Preview
Python#!/usr/bin/env python3
"""
DKIM Record Checker - Email Signature Validator
Validates DKIM records for email authentication
"""
import dns.resolver
import re
def check_dkim_record(domain, selector='default'):
"""Check DKIM record for a domain and selector"""
try:
dkim_domain = f'{selector}._domainkey.{domain}'
txt_records = dns.resolver.resolve(dkim_domain, 'TXT')
for record in txt_records:
txt = ''.join([s.decode() if isinstance(s, bytes)
else s for s in record.strings])
if 'v=DKIM1' in txt or 'p=' in txt:
# Parse DKIM record
version = re.search(r'v=([^;]+)', txt)
key_type = re.search(r'k=([^;]+)', txt)
public_key = re.search(r'p=([^;]+)', txt)
return {
'domain': domain,
'selector': selector,
'status': 'VALID',
'dkim_record': txt,
'version': version.group(1) if version else 'DKIM1',
'key_type': key_type.group(1) if key_type else 'rsa',
'has_public_key': bool(public_key and public_key.group(1))
}
return {'domain': domain, 'selector': selector,
'status': 'INVALID', 'error': 'No DKIM record found'}
except dns.resolver.NXDOMAIN:
return {'domain': domain, 'selector': selector,
'status': 'MISSING', 'error': 'DKIM record not found'}
except Exception as e:
return {'domain': domain, 'selector': selector,
'status': 'ERROR', 'error': str(e)}
# Common selectors to check
COMMON_SELECTORS = ['default', 'selector1', 'selector2',
'google', 'k1', 's1', 's2', 'mail']
if __name__ == '__main__':
domain = input('Enter domain: ')
for selector in COMMON_SELECTORS:
result = check_dkim_record(domain, selector)
if result['status'] == 'VALID':
print(f"Found: {selector}._domainkey.{domain}")
print(f"Key Type: {result['key_type']}")
break
info About This Tool
The DKIM Record Checker validates DomainKeys Identified Mail records, which use cryptographic signatures to verify email authenticity. DKIM ensures emails haven't been modified in transit.
Key Features
- DKIM Record Lookup - Retrieves DKIM records from DNS TXT entries
- Multi-Selector Support - Checks common selectors (google, selector1, etc.)
- Key Validation - Verifies public key presence and format
- Signature Verification - Validates DKIM signature structure
- Bulk Checking - Process multiple domains at once
Why DKIM Matters
- Proves email wasn't modified in transit
- Improves deliverability with major providers
- Required for DMARC alignment
- Protects brand reputation
Common Selectors
Email providers use different selectors:
- Google Workspace: google
- Microsoft 365: selector1, selector2
- SendGrid: s1, s2
- Mailchimp: k1
Requirements
- Python 3.7+
- dnspython library (
pip install dnspython)
Tip: If you don't know your DKIM selector, the tool will automatically check common selectors used by popular email providers.
download Download Script
Need Full Automation?
Try Postigo for automated email campaigns with AI personalization
rocket_launch Start Free Trial