RealRaven2000 / quickFilters

Thunderbird Add-on: quickFilters
http://quickfilters.quickfolders.org/
Other
49 stars 11 forks source link

Rules for creating new folders from path variables #85

Open youpi2000 opened 2 years ago

youpi2000 commented 2 years ago

Move message to...

variable %tld% / %domain% / %subdomain% / %mailbox%

Example : move to ./com/thedomainforexample/thesubdomain/themailbox

RealRaven2000 commented 2 years ago

You probably mean new variable epxressions for custom filters, and have seen the existing variables (such as %from(domain)% )

image

Could you elaborate with some example on how the following variables would be retrieved from the original email (or dropping the mail to a target folder) ?

%subdomain%

%mailbox%

%tld%

Also, please bear in mind that filters will not create the folders for you - so you would have to create these folders manually before using the filter. Creating new folders from an email during filtering would be very difficult on account of that being an asynchronous operation.

youpi2000 commented 2 years ago

The goal is to sort automatically all mails received (in local folders) as this :

TLD\DOMAIN\SUBDOMAIN\Mailbox

Example :

A mail from paul@example.com is received The rule move it to folder ./com/example/paul

This with automatic creation of folders yes (by this way, no need to create a rule for each type of mail)

By this way, we can store the mails in one folder and use a lot of preset filter via Virtual folder + shortcuts of them in the Quickfolder tabs

Difficult yes, but for the Wonderfull Guru behind this Wonderfull Software, it's "maybe" possible -_-

youpi2000 commented 2 years ago

It's possible on MSO via External module But, for me the Virtual folder + quickfolder offer more functionalities

RealRaven2000 commented 2 years ago

again, what is %tld% in this example ? if it is an acronym / initialise then what did T.L.D. for?

What is %subdomain%? in normal speech subcontinent would be any string before example.com e.g. in business.example.com the subdomain would be "business".

in your example %domain% will be replaced with the string "example.com" (in quickFilters and SmartTemplates it stands for the complete string after the @ sign)

On Mon 27 Dec 2021, 21:21 youpi2000, @.***> wrote:

The goal is to sort automatically all mails received (in local folders) as this :

TLD\DOMAIN\SUBDOMAIN\Mailbox

Example :

A mail from @.*** is received The rule move it to folder ./com/example/paul

This with automatic creation of folders yes (by this way, no need to create a rule for each type of mail)

By this way, we can store the mails in one folder and use a lot of preset filter via Virtual folder + shortcuts of them in the Quickfolder tabs

Difficult yes, but for the Wonderfull Guru behind this Wonderfull Software, it's "maybe" possible -_-

— Reply to this email directly, view it on GitHub https://github.com/RealRaven2000/quickFilters/issues/85#issuecomment-1001765802, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABQFVMRBM6HGI3P4BGTNCZ3UTDKHFANCNFSM5K2ZNHLQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

youpi2000 commented 2 years ago

TLD = Top-level domains (com; net) and I've made an error with this. In fact it's more precise to use %extension% variable. The goal is to separate 2 informations mixed in the variable %domain%" (Extension + Domain)

The goal is to obtain a structure of folders as below :

.

COM

GITHUB

Support

NET

DOMAIN TEST

Info

By this way, we avoid the dupplication of data displayed on screen.

Site 1.com Site 2.com Site 3.com

Become

.

COM

Site 1 Site 2 Site 3 ....

I add that this functionality will offer to reduce quantity of manual action. In this type of structure, it's not required to create a specific rule for each domain etc. Only one rule is enough to auto-filter the incoming and outgoing messages.

RealRaven2000 commented 2 years ago

I suggest the following additions, and they all start with the keyword "domain" for maximum clarity:

%from(domain.extension)% - this should also include multiple subdomains such as ".com.pl" (this on is a little tricky. I need to find out whether there is a good regular expression to do this.

%from(domain.subdomain)% - the first part of the domain name e.g. "en" in "en.wikipedia.org". Should this fall back to "wikipedia" if the domain doesn't have a subdomain?

%from(domain.root)% - the root domain, normally the same as %from(domain)% but stripping off all subdomains. So it would return "wikipedia.org" for "en.wikipedia.org".

Note these domain name operations are just happening when generating the new filter with custom templates, not while the filter is run. At that stage the filter just uses whatever string was generated by the custom template.

RealRaven2000 commented 2 years ago

An addendum: automatic generation of folders is difficult, as the moving of emails should be asynchronous (and is controlled by Thunderbird) but running filters is synchronous. This means I would have to somehow generate the folder in a separate custom made action first and check for its existence (without this step showing explicitly in Thunderbird's filter editor) - sounds more like a task for FiltaQuilla which adds whole new actions to the filter mechanisms.

You would need a new action "create folder and move mail". The other problem is that it needs 2 parameters, the folder name and the parent folder.

RealRaven2000 commented 2 years ago

So my previous comment about the different variable names relate to search conditions, not to a completely new "create folder" action as that is a lot harder to implement.

RealRaven2000 commented 2 years ago

Writing a bit of code here, after already translating the three new variations, I realize it is actually non-trivial to distinguish top level domain from domain extensions, there is a big list of official multi-part extensions some of which really look like domain names. Certainly not possible to do this with a regular expression:

https://publicsuffix.org/

Example: Surprisingly in the URL "boing.consulting.aero" there is no subdomain. the root domain is "boing" and the extension / suffix is "consulting.aero".

RealRaven2000 commented 2 years ago

Just to get started on the condition part, here is a test version that adds more custom variables for the "from" header. These show up when you create or edit a custom template:

image

quickFilters-wx-5.4.1pre17.zip

to test / install, download the zip file and drag into Thunderbird Add-ons Manager (leave archive intact, don't extract the contents)