Table of Contents
Smart Catchall with Sieve Filters
I've set up a simple but effective system using Sieve filters to track which services might be leaking my email address.
How It Works
The beauty of this setup is that thanks to the catchall configuration, no email addresses need to be manually created in advance. I can simply make up new addresses on the fly when signing up for services, and they'll automatically work with this filtering system.
The Sieve Filter
The editheaders
extension may need to be explicitly activated in your mail server configuration.
require ["copy", "imap4flags", "editheader", "variables", "envelope"];
set "mydomain" "example.com";
set "label" "EXAMPLE";
set "forward_to" "myemail@example.org";
# rule:[Manipulate Subject and Forward]
if address :domain :is "to" "${mydomain}" {
if header :matches "Subject" "*" {
set "subject" "${1}";
}
set "local_part" "unknown";
if anyof (
header :matches "X-Original-To" "*@${mydomain}",
header :matches "Delivered-To" "*@${mydomain}",
envelope :matches "to" "*@${mydomain}"
) {
set "local_part" "${1}";
}
deleteheader "Subject";
addheader :last "Subject" "[${label}/${local_part}] ${subject}";
redirect :copy "${forward_to}";
addflag ["\\Seen", "Forwarded"];
}
When I receive an email with a subject like "[EXAMPLE/amazon] Your Order", I immediately know which address received it. If spam starts arriving at a specific address, I can identify which service leaked my information and take appropriate action.
This setup provides excellent tracking capabilities while keeping my inbox organized and my main email private.