Sieve filtering "subaddress" support
The 'subaddress' extension described in RFC 5233 (https://tools.ietf.org/html/rfc5233.html) is a nice addition in the possibilities of mail filtering.
It would make it possible to filter mails with an specific tag (address+tag@domain.com). E.g. such a filter can be used to add a label to a mail:
if envelope :detail "to" "tag" {
fileinto :create "Tag";
}
Or even better, add a label for any tag in the receiving mail.
if envelope :matches :detail "to" "*" {
fileinto :create "${1}";
}

-
Connor commented
Also, the :create flag requires the "mailbox" extension, which is mentioned in another, more popular request. In fact you can handle subaddresses with just the mailbox extension:
require ["fileinto","imap4flags","variables","regex","mailbox"];
## Move messages sent to an address with a suffix eg, me+amazon@example.com in to a folder called amazon, creating it if not
if exists "X-Delivered-To" {
if header :regex "X-Delivered-To" "\\+([A-z0-9]+)@" {
set :upperfirst "suffix" "${1}"; ## capitalize folder name
fileinto :create "INBOX.${suffix}";
stop;
}
} -
Eric Johnson commented
Filter on the header (I just posted about this)
if header :comparator "i;unicode-casemap" :contains "X-Original-To" "example+0623nat@pm.me"
{
addflag "\\Flagged";
fileinto "Reference/News";
fileinto "Nature";
stop;
}where News is a subfolder of Rference and Nature is a label/tag.
Using header ... "X-Original-To" ..., also filters properly if the sender puts the address as part of a BCC.