I realize that with this string, vs my original, the actual MailMate list renames from “MailMate Users” to “MlMt” (due to the blob). May warrant a reordering of the variable priorities. I’ll post a revision here if that’s the case. -Ethan
On 2 Jun 2021, at 13:30, Ethan Schoonover wrote: > # Better MailMate Mailing List Submailbox Naming > > I've revised my previous mailing list submailbox naming format string and the > improved (and documented) code is below. You can just use the Quick > Instructions if wish and ignore the rest, but I’ve documented the way this > works if you want to dig in a bit. > > This is a complete rewrite of my previous code in this thread and I recommend > you use this version vs the earlier code I submitted. > > Benny, I don’t know if you’d consider making this a default, but I think it’s > a good improvement on the current default. > > -Ethan Schoonover > [email protected] > https://ethanschoonover.com > > ## What & Why > > The Mailing Lists smart mailbox in MailMate is **very** powerful and > something I use a heavily. However the default MailMate Mailing List > submailbox naming format string results in some garbled subfolder names like > the following: > > ``` > 440ea9583e4f6b5c9cb1e2578fbaf6edb856e288 > 54533714ba0665d954ad3759bmc list > 514005412 > ``` > > By writing a new submailbox format string, we can clean these up and show, in > most cases, a sensible mailbox name. Follow the quick instructions below to > do this, or dig into the details farther down. > > ## Quick Instructions > > 1. Double click your "Mailing Lists" smart mailbox in MailMate > 2. Select the "Submailboxes" tab > 3. Copy the following code (this is the same as the **CLEAN VERSION** snipped > below) and paste it into your Mailing Lists > Submailboxes > Mailbox Name > Format field. > > ``` > ${subject.blob:?${subject.blob:/capitalize}:${list-id.description:?${list-id.description/^[a-z]*\d.*/${from.name:${list-id.identifier.final-level:?${list-id.identifier.final-level:/capitalize}:${from.address}}}/}:${from.name:${list-id.identifier.final-level:?${list-id.identifier.final-level:/capitalize}:${from.address}}}}} > ``` > > ## Summary > > This submailbox string will look for each of the following variables from the > mailing list messages in turn, choosing the first that is available based on > the order presented below. > > In the special case of the List ID, these sometimes return a gibberish (to > human eyes) alphanumeric string of characters. In those cases, the List-ID is > not used (technically it is used but regex replaced with the options from the > remainder of the sequence below). > > ### Options for list naming, in order > > 1. Subject Blob > 2. List ID Description if not all alphanumerics > * if alphanumerics only, then continue with options below > 3. From Name > 4. List ID Identifier (final part) > 5. From Address > > Below you will find three versions of the code for this mailing list naming > string. The nested version is easy to read, the "commented" version can be > pasted in so you can see how your lists names are being assigned, and the > "clean" version is uncommented and what you will ultimately want to use. > > ## Commented Code - Nested format (DO NOT PASTE IN, FOR REFERENCE ONLY) > > First: use the subject blob if present. This is the prefix part of the > subject that is often in brackets [Like This]. I prioritize this because it > seems to be an intentional and consistent list-naming method. If it is > present we select it and capitalize it. > > If there is no blob we use the list description (again, if present). > Unfortunately this sometimes is a random string of alphanumerics (blame > poorly written marketing mailing list software, not MailMate). If that is the > case, we effectively just keep going through out list (technically we regex > replace the list-id with one of the following options, resulting in some code > duplication as noted by the starred code comments in double brackets below). > > Moving on, if we haven't found a good match yet we try the From Name and then > finally the List-ID Identifier and, if all else fails, the From Address > (something every mail is guaranteed to have). > > Note: the starred (* or **) elements represent a duplicated sequence, > required in order to use the List-ID when present. > > ``` > ${subject.blob:? > [[HAS-SUB-BLOB]] ${subject.blob:/capitalize}: > [[NO-SUB-BLOB]] ${list-id.description:? > [[HAS-LISTID]] ${list-id.description/^[a-z]*\d.*/ > [[BAD-LISTID]] ${from.name: > [[*NO-FROM-NAME*]] > ${list-id.identifier.final-level:? > [[*HAS-LISTID-FINAL*]] > ${list-id.identifier.final-level:/capitalize}: > [[*NO-LISTID-FINAL*]] ${from.address} > } > } > /}: > [[NO-LISTID]] ${from.name: > [[**NO-FROM-NAME**]] ${list-id.identifier.final-level:? > [[**HAS-LISTID-FINAL**]] > ${list-id.identifier.final-level:/capitalize}: > [[**NO-LISTID-FINAL**]] ${from.address} > } > } > } > } > ``` > > ## COMMENTED VERSION (if you want to tweak/understand) > > Paste this if you want to see how it works with your lists. > > ``` > ${subject.blob:?[[HAS-SUB-BLOB]] ${subject.blob:/capitalize}:[[NO-SUB-BLOB]] > ${list-id.description:?[[HAS-LISTID]] > ${list-id.description/^[a-z]*\d.*/[[BAD-LISTID]] > ${from.name:[[*NO-FROM-NAME*]] > ${list-id.identifier.final-level:?[[*HAS-LISTID-FINAL*]] > ${list-id.identifier.final-level:/capitalize}:[[*NO-LISTID-FINAL*]] > ${from.address}}}/}:[[NO-LISTID]] ${from.name:[[**NO-FROM-NAME**]] > ${list-id.identifier.final-level:?[[**HAS-LISTID-FINAL**]] > ${list-id.identifier.final-level:/capitalize}:[[**NO-LISTID-FINAL**]] > ${from.address}}}}} > ``` > > ## CLEAN VERSION (no comments, USE THIS ONE if you just want to fix it fast) > > Paste this in if you just want better list names and don't need to see how > it's working. > > ``` > ${subject.blob:?${subject.blob:/capitalize}:${list-id.description:?${list-id.description/^[a-z]*\d.*/${from.name:${list-id.identifier.final-level:?${list-id.identifier.final-level:/capitalize}:${from.address}}}/}:${from.name:${list-id.identifier.final-level:?${list-id.identifier.final-level:/capitalize}:${from.address}}}}} > ``` > > ## ORIGINAL MailMate Mailing Lists Subfolder Format String > > Paste this in if you want to revert to the original MailMate behavior. > > ``` > ${list-id.description:${subject.blob:?${subject.blob:/capitalize}:${list-id.identifier.final-level}}} > ```_______________________________________________ > mailmate mailing list > [email protected] > https://lists.freron.com/listinfo/mailmate
_______________________________________________ mailmate mailing list [email protected] https://lists.freron.com/listinfo/mailmate
