Sieve 'fileinto' automatic folder creation
Sieve filters can be used on some server software (true for Dovecot, for example) to automatically create the folders specified in the 'fileinto' command if they do not already exist.
Maybe I'm mistaken, but it doesn't seem to be the case for Protonmail.
Why it is useful (in my opinion at least):
If you share sieve rules between several servers, automatic folder creation helps sharing these rules without having to create the folders on all the mail servers.
It allows dynamic folder creation based on email metadata (e.g. sender, subject, ...).
It could also be combined with the regex sieve extension, in which case it makes folder storing magical.
Cheers !
-
Nathan Clayton commented
This was requested almost 5.5 years ago. Has there been any movement on this? This alongside the inability to forward emails from sieve scripts was a huge blocker for me to use Proton as my primary email account at the personal level.
-
Connor commented
The Title of this should mention the Sieve Extension's name: Mailbox.
This is needed for me to take advantage of PM's +aliases feature. Simple example that works on other platforms:
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;
}
} -
Drew commented
Yes!
fileinto :create is critical for managing mail in sieve. This should be easy win. -
kiirani commented
I want to use this to automatically file emails based on their simplelogin aliases. Lists of emails from multiple sources all together are difficult to scan and emails get missed.
Ideally both label and folder creation would be supported.
-
FireFish5000 commented
FWIW, this feature is actualy documented as if it already exists in the variables sections of the docs
https://proton.me/support/sieve-advanced-custom-filters#creating-variables
https://proton.me/support/sieve-advanced-custom-filters#transforming-variables
Last example they provide is supposed to label based on the sender's address character count plus some math. Definitely not something your expected to create labels for beforehand.
require "variables";
require "fileinto";
require "vnd.proton.eval";
# do a match test on the sender address
if header :matches "from" "*" {
# create a variable called length, containing the length of the first
# matching variable
set :length "length" "${1}";
# Create a variable called fileintovar containing the result of the expression written below
set :eval "fileintovar" "${length} * 25 - 1 / 8+3";
fileinto "${fileintovar}";
}That said, none of the 3 examples would work in practice as documented since proton uses fileinto for both folders and labels. But if they added some small extensions to the language `fileinto :create :folder "${1}"` and `fileinto :create :label "${1}"` and modified the docs it should work and be backwards compatible since all new features would only be enabled by more explicit syntax.
I, like the docs, find this to be "The most interesting use case of variables".
-
Nathan Clayton commented
This is supported in Fastmail and it makes keeping your archives neat and clean so much nicer.
-
Dan commented
Yes please. Creating folders dynamically via a script would give an edge over a lot of the other email services out there.
-
dpatrick commented
This would be really useful. The spec is at https://tools.ietf.org/html/rfc5490
Simple example of usage:
require ["fileinto", "variables", "mailbox"];
if address :matches "to" "*@example.com" {
fileinto :create "${1}";
}