3

GMail has some great features, one of which is label tagging to organize your inbox. However, I have a situation where I stuff all "waste of time" emails that sometimes I peruse into the following label structure:

Entertainment Entertainment/Politics Entertainment/Twitter Entertainment/etc...

So, I can easily search "has label:Entertainment/Facebook" although I would rather be able to search "has label:Facebook"

But, most of all, I'd really like to be able to search for ALL Entertainment emails at once, like

"has label:Entertainment*"

Unfortunately... GMail does not support wildcard (*, %) nor "nested" labels (I know they aren't actually nested).

Is this literally impossible or am I missing something?

1 Answer 1

1

I feel your pain. If you nest a label one would assume (prefer) that the parent label inherit the child label, but as you've noted, it does not.

A common solution is to add another filter that catches all the same messages as combining the 'child' labels into a single filter would.

Mail Filter 1:
   from:([email protected]) 
   Label: school/sonselementary

Mail Filter 2:
   from:([email protected]) 
   Label: school/sallyssecondary

Mail Filter 3 (1 & 2 Combined):
   from:([email protected]) OR from:([email protected]) 
   Label: school

This does the trick however becomes very difficult to manage over time. You need to remember to update rules in several places. You might have child labels that are themselves parent labels and the complexity becomes overwhelming.

I started building an Excel spreadsheet that creates the code for the rules for me and also manages the relationship between parents, children and siblings. It hasn't been without it's own 'learnings' along the way and I will likely try to finish it using a more DB/scripting approach as I am stretching Excel into shapes it doesn't look good in.

It is a huge advantage to me to delete and recreate rules as (1) you can update multiple rules quickly, (2) you can apply multiple rules quickly (i.e. Gmail asks if you'd like to apply them as part of the import process, (3) you can reorder your rules simply by deleting and reimporting your rules in a new order if you strip out unique identifiers before import. I have preferences for my order unrelated to when the rule was created.

12
  • 3
    I was afraid this would be the answer. A sad day indeed. But - thank you for this solution and I like where you are going with the automated rule generator. You might consider making this a GMail plugin if it exposes enough via their API (which I've not looked into yet). Then you could actually publish it as a plugin - just a thought. :)
    – Gr3go
    Sep 28, 2021 at 16:43
  • 1
    I'll post something back if I get that far. :-)
    – Blind Spots
    Sep 28, 2021 at 21:33
  • 1
    @Gr3go my rule generator adventure has exposed challenges/limitations of generalizing it to other users' needs. HTML Gmail's search syntax is limited. Complicated searches, if achievable, have a high character count which is amplified if combined in parent filters. Combined searches are fraught with error paths even with insight into the needs and the syntax. I continue to evolve my approach as I learn more. I am trying a different approach using scripting to avoid some of the pitfalls. I'll update.
    – Blind Spots
    Oct 14, 2021 at 18:15
  • 1
    The script is working great. Will refine it over time. Unfortunately I am fairly new to Google App Script and Github so trying to muddle my way through the best way to share it for others in a timely manner.
    – Blind Spots
    Nov 16, 2021 at 18:18
  • 1
    I posted it on Github: github.com/CaTeNdrE/gas-gmail-add-parent-of-nested-label forgot to add info on how to create a time-based trigger. I'll try to do that today or tommorow.
    – Blind Spots
    Nov 17, 2021 at 23:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.