<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/xhtml; charset=utf-8">
<style>
div.markdown { white-space: normal; }
body { font-family: sans-serif; }
h1 { font-size: 1.4em; }
h2 { font-size: 1.2em; }
h3 { font-size: 1.1em; }
blockquote { margin: 0 0 5px; padding-left: 5px; border-left: 2px solid #777777; color: #777777; }
blockquote blockquote { border-left-color: #999999; color: #999999; }
blockquote blockquote blockquote { border-left-color: #BBBBBB; color: #BBBBBB; }
a { color: #3983C4; }
blockquote a { color: #777777; }
blockquote blockquote a { color: #999999; }
blockquote blockquote blockquote a { color: #BBBBBB; }
pre { margin-left: 15px; margin-right: 15px; padding: 5px; background-color: #F7F7F7; border-radius: 5px 5px 5px 5px; overflow-x: auto; max-width: 90vw; }
code { margin: 0; padding: 0 0.4em; border-radius: 3px; background-color: #F7F7F7; }
pre > code { padding: 0px; }
math[display="inline"] > mrow { padding:5px; }
div.footnotes li p { margin: 0.2em 0; }
</style>
</head>
<body>
<div class="markdown">
<p dir="auto">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</p>
<p dir="auto">On 2 Jun 2021, at 13:30, Ethan Schoonover wrote:</p>
<blockquote>
<h1>Better MailMate Mailing List Submailbox Naming</h1>
<p dir="auto">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.</p>
<p dir="auto">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.</p>
<p dir="auto">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.</p>
<p dir="auto">-Ethan Schoonover<br />
<a href="mailto:es@ethanschoonover.com">es@ethanschoonover.com</a><br />
<a href="https://ethanschoonover.com">https://ethanschoonover.com</a></p>
<h2>What & Why</h2>
<p dir="auto">The Mailing Lists smart mailbox in MailMate is <strong>very</strong> 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:</p>
<pre><code>440ea9583e4f6b5c9cb1e2578fbaf6edb856e288
54533714ba0665d954ad3759bmc list
514005412
</code></pre>
<p dir="auto">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.</p>
<h2>Quick Instructions</h2>
<ol>
<li>Double click your "Mailing Lists" smart mailbox in MailMate</li>
<li>Select the "Submailboxes" tab</li>
<li>Copy the following code (this is the same as the <strong>CLEAN VERSION</strong> snipped below) and paste it into your Mailing Lists > Submailboxes > Mailbox Name Format field.</li>
</ol>
<pre><code>${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}}}}}
</code></pre>
<h2>Summary</h2>
<p dir="auto">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.</p>
<p dir="auto">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).</p>
<h3>Options for list naming, in order</h3>
<ol>
<li>Subject Blob</li>
<li>List ID Description if not all alphanumerics</li>
</ol>
<ul>
<li>if alphanumerics only, then continue with options below</li>
</ul>
<ol start="3">
<li>From Name</li>
<li>List ID Identifier (final part)</li>
<li>From Address</li>
</ol>
<p dir="auto">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.</p>
<h2>Commented Code - Nested format (DO NOT PASTE IN, FOR REFERENCE ONLY)</h2>
<p dir="auto">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.</p>
<p dir="auto">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).</p>
<p dir="auto">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).</p>
<p dir="auto">Note: the starred (* or **) elements represent a duplicated sequence, required in order to use the List-ID when present.</p>
<pre><code>${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}
                        }
                }
        }
}
</code></pre>
<h2>COMMENTED VERSION (if you want to tweak/understand)</h2>
<p dir="auto">Paste this if you want to see how it works with your lists.</p>
<pre><code>${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}}}}}
</code></pre>
<h2>CLEAN VERSION (no comments, USE THIS ONE if you just want to fix it fast)</h2>
<p dir="auto">Paste this in if you just want better list names and don't need to see how it's working.</p>
<pre><code>${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}}}}}
</code></pre>
<h2>ORIGINAL MailMate Mailing Lists Subfolder Format String</h2>
<p dir="auto">Paste this in if you want to revert to the original MailMate behavior.</p>
<pre><code>${list-id.description:${subject.blob:?${subject.blob:/capitalize}:${list-id.identifier.final-level}}}
```_______________________________________________
mailmate mailing list
mailmate@lists.freron.com
https://lists.freron.com/listinfo/mailmate
</code></pre>
</blockquote>

</div>
</body>
</html>