update-sieve-list-unsubscribe.js•2.37 kB
#!/usr/bin/env node
// This script shows the sieve rule addition needed to catch List-Unsubscribe emails
// Add this rule to the sieve file after the loop prevention section
console.log('📧 SIEVE RULE UPDATE FOR LIST-UNSUBSCRIBE EMAILS\n');
const newSieveRule = `
# Block/organize ALL emails with List-Unsubscribe headers (marketing/automated)
# These should never stay in inbox regardless of sender
if header :contains "List-Unsubscribe" "mailto" {
# Route based on content type
if anyof (
header :contains "subject" ["payment", "receipt", "transaction", "statement", "balance", "bill"],
address :domain :is "from" ["paypal.com", "stripe.com", "chase.com", "fidelity.com", "schwab.com"]
) {
fileinto "Financial";
stop;
}
if anyof (
header :contains "subject" ["order", "shipped", "delivered", "tracking", "subscription"],
address :domain :is "from" ["amazon.com", "etsy.com", "walmart.com", "target.com"]
) {
fileinto "Commerce";
stop;
}
if anyof (
header :contains "subject" ["github", "security", "login", "password", "build"],
address :domain :is "from" ["github.com", "google.com", "microsoft.com"]
) {
fileinto "Professional";
stop;
}
# Default: All other List-Unsubscribe emails go to Information/Newsletters
fileinto "Information";
stop;
}`;
console.log('📝 ADD THIS RULE TO SIEVE FILE:');
console.log('Insert after line 665 (after loop prevention, before whitelist)');
console.log('='.repeat(80));
console.log(newSieveRule);
console.log('='.repeat(80));
console.log('\n🎯 THIS WILL CATCH:');
console.log('✅ Azure delivery emails with List-Unsubscribe headers');
console.log('✅ Any marketing emails from personal domains');
console.log('✅ Newsletter emails regardless of sender domain');
console.log('✅ All automated promotional content');
console.log('\n📧 RESULT:');
console.log('The Azure delivery email will auto-route to Information/Newsletters');
console.log('True inbox zero will be maintained automatically');
console.log('\n⚠️ DEPLOYMENT:');
console.log('1. Add this rule to fastmail-sieve-rules.txt');
console.log('2. Upload updated sieve file to FastMail');
console.log('3. Test with a few incoming emails');
console.log('4. Monitor for any legitimate emails being caught');