Regular Expressions for Conditions and Submailboxes
Reported by Vadim Belobrovka | January 6th, 2016 @ 02:41 PM
Hi,
-
Please provide support for Regex in Smart Mailbox Conditions. "Contains" is just not cutting it.
-
Another huge one is Regex support in Submailboxes - I would like to be able to group by unique value that is extracted via a REGEX. For example github emails that are coming in due to a given pull request communication come in this format:
"[repo name] pull request name"
I would like to be able to extract repo name and group all the github communication emails by those repo names via Submailboxes.
All hail MailMate!
Thank you very much!
Vadim
Comments and changes to this ticket
-
Chris February 8th, 2017 @ 12:41 AM
Hi, I endorse the request for regex support in conditions.
In addition, I suggest the following:
1) add condition "Value in Header"
2) allow user to enter header elements (e.g., custom x-headers) not found in current mails while setting up rules
3) interface to manage, import and export rules or rulesets, so that you can easily assign them to different foldersFortunately, one can edit the relevant config files; that helps a lot with 2) and 3).
May I use the opportunity to ask what "any address" includes?
-
Tee Yen Ng November 29th, 2017 @ 06:01 AM
FWIW, I was just looking for a way to do just this. Turned up this ticket, but found a semi-solution subsequent. Thought it best to leave a bread crumb for anyone else searching :)
You can use regexp in the Mailbox name format: entry under sub-mailboxes.
I still end up with a submailbox for each individual subject, but the mailbox names are displayed as per the regexp. For example:
${subject.body/(.*)RFI[ -]*([0-9]+)\s*(.*)/RFI-${2} - ${3}/}
Would be curious if there is a way to use the custom mailbox name format as the unique value!
Found this over here:
http://blog.froztbyte.net/2016/12/mailmate-submailbox-snr-hack/ -
Tee Yen Ng November 29th, 2017 @ 06:43 AM
OK dug further, and turns out this is a common thing.
Has been solved here:
https://lists.freron.com/mailmate/2012-February/000197.html
Other commentary along the way:
https://lists.freron.com/mailmate/2014-March/002252.html
https://lists.freron.com/mailmate/2017-June/008208.html -
benny November 29th, 2017 @ 12:35 PM
- State changed from new to accepted
@Tee Yen Ng: Thanks for the updates and for finding the relevant information yourself. The low-level editing of custom specifiers is still the only way to get regular expressions. I'm thinking it'll stay this way, but I might eventually add a GUI for creating new specifiers more easily. This is what the “accepted” state is for in this ticket.
Sorry for not replying to this ticket earlier on.
-
Muescha January 25th, 2018 @ 12:58 AM
i tried all rules for submailbox:
${subject.body/([\[\]a-zA-Z]*).*/${1}/}
but for a
"[abc] Subject"
i always get an list of unique folders with always one entry (like the screenshot)i get it not working
But i find out just Change it to
"subject -> blob"
i get a list of the [abc] selectors.BTW:
- i think there should be a better documentation of all the hidden features
- editing the plist fildes are to complicated just now :(
-
X X July 8th, 2024 @ 03:16 PM
- State changed from accepted to new
I came across this while searching for a way to use regular expressions when creating a smart mailbox. I tried using regex along with the "contains" option but that did not work.
Here's what I would like to do. Student emails at our school have a very specific format: a letter followed by nine digits, and I would like to create a smart mailbox that contains emails from those with that address format.
Is there a way to do this?
Thanks!
-
benny July 10th, 2024 @ 07:08 AM
Regular expressions are not directly supported in the query system, but it's possible to introduce new specifiers which is what you need here. It's low-level, but here we go. Create this folder and file:
/Users/<username>/Library/Application Support/MailMate/Resources/specifiers.plist
Give it this content:
{ parsers = { extra_from = { header = "from"; specifierRegex = '.*([A-Za-z]\d{9})@.*'; specifierCaptures = { 1 = { specifier = "student"; }; }; }; }; }
I haven't tested it, but try relaunching MailMate and then use the Statistics layout (see View > Layout) to see if you now have the option of selecting “From > Student”. You can then also see the values it found if it works.
I'm sorry it's not more user-friendly.
-
X X July 10th, 2024 @ 08:46 AM
Thank you very much Benny for the quick response and for the details on how to get this done!
Can confirm this works exactly as I expected.
-
Ayhan October 30th, 2024 @ 09:49 PM
Hello,
For me, lack of GUI isn't much of a problem for specifiers. If someone is able to cook up REGEXes, the chances are, they are probably able to write that in a text file in some syntax.
It is however quite troublesome to have to do it in the same file as the "built-in" specifiers (or an entire copy of that file). A lot of things can go wrong, in ways that are quite hard to debug, whenever MailMate is upgraded with changes to the built-specifiers (modify, add, remove).
Imho, supporting a "
specifier-overrides
" file, would be a much "cleaner" approach.That way, we can just add our own specifiers in there, without having to copy over the built-in specifiers. Those would still be maintained in the Application's Resources and would automatically get updated with new versions of MailMate.
If need be, it would still be possible to "override" any built-in specifier, but that would be rather rare situation.
My 2 cents...
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
Mac OS X email client.