Modern spam filters like Outlook's SmartScreen employ multi-layered analysis:
- Content scoring algorithms (e.g., SpamAssassin's rule-based system)
- IP reputation checks via RBLs (Spamhaus, Barracuda)
- DKIM/DMARC/SPF authentication protocols
- Engagement metrics (open rates, reply patterns)
Start with these DNS records (example for domain.com):
// SPF Record
v=spf1 include:_spf.google.com include:mailservers.domain.com ~all
// DKIM Record (2048-bit recommended)
v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A...
// DMARC Policy
v=DMARC1; p=none; rua=mailto:dmarc@domain.com; ruf=mailto:abuse@domain.com
For transactional emails (PHP example):
$headers = [
'From: "Support Team" ',
'Reply-To: no-reply@domain.com',
'List-Unsubscribe: ',
'Content-Type: text/html; charset=UTF-8',
'X-Entity-Ref-ID: '.bin2hex(random_bytes(16))
];
RFC-compliant one-click unsubscribe (Python Flask example):
@app.route('/unsubscribe/')
def unsubscribe(token):
try:
email = verify_signature(token) # JWT or similar
update_db(email, status='unsubscribed')
return jsonify({'status': 'success'}), 200
except Exception as e:
return jsonify({'error': str(e)}), 400
Gradual volume increase schedule (SMTP log example):
Day 1-3: 50 emails/hour (warm-up phase)
Day 4-7: 150 emails/hour (ramp-up phase)
Day 8+: Monitor reputation before scaling
Essential command-line tools for debugging:
# Check DNS records
dig TXT domain.com
nslookup -type=TXT _dmarc.domain.com
# Test email headers
curl -v smtp://mail.domain.com -mail-from sender@domain.com -rcpt recipient@example.com
# Spam score analysis
spamassassin -e < email_sample.eml
Modern spam filters like Outlook's SmartScreen use complex algorithms combining factors like:
- Sender authentication (SPF, DKIM, DMARC)
- Content analysis (trigger words, HTML structure)
- Sender reputation (IP/domain history)
- Recipient engagement (open rates, spam reports)
1. DNS Records Setup
Example SPF record (TXT):
v=spf1 ip4:192.0.2.0/24 include:_spf.google.com ~all
Example DKIM record (1024-bit RSA):
v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC...
2. Email Header Best Practices
From: "Service Name" <no-reply@yourdomain.com> Reply-To: support@yourdomain.com List-Unsubscribe: <https://yourdomain.com/unsubscribe?token=UNIQUE_ID> X-Entity-ID: 1234567890
HTML Email Template Example
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Your Newsletter</title> <style> body { font-family: Arial, sans-serif; line-height: 1.6; } .unsubscribe { color: #999; font-size: 12px; } </style> </head> <body> <h1>Main Content Here</h1> <p>...email content...</p> <div class="unsubscribe"> <a href="[UNSUBSCRIBE_LINK]">Unsubscribe</a> </div> </body> </html>
Using Python's email-validator library:
from email_validator import validate_email, EmailNotValidError def verify_email(email): try: v = validate_email(email, check_deliverability=True) return v.email except EmailNotValidError as e: raise ValueError(str(e)) # Example usage: clean_email = verify_email("user@example.com")
Key metrics to track:
- Spam complaint rate (<0.1% recommended)
- Bounce rate (<2% recommended)
- Open/click-through rates
Example using Postmark API to check stats:
import requests def get_email_stats(api_key): headers = {"X-Postmark-Server-Token": api_key} response = requests.get( "https://api.postmarkapp.com/deliverystats", headers=headers ) return response.json()
Example warm-up schedule (emails per day):
Day | Volume |
---|---|
1-3 | 50-100 |
4-7 | 100-200 |
8-14 | 200-500 |
15+ | Gradual increase |