I've been using the Gmail.gem to pull email counts in a Personal Dashboard for a couple years. And, in Gmail, I use Superstars, which are flags you can toggle through on an email. I was disappointed not to be able to filter Superstars through the email.
A recent Stack Overflow article pointed me in the right direction.
I use Gmail Superstars, which enables additional flags where the standard yellow-star
is used. Below, you can see the red-bang
and green-check
.
How I Use Superstars
I use red-bang
for emails I need to respond to.
I use the orange-guillemet
for emails that I'm awaiting a response on.
I use the green-check
for emails I have completed. (Though, most of the time I just archive things as I complete them).
And, I use the yellow-star
for informational items, sorta like a bookmark.
Searching for GMail Superstars
Superstars labels are searchable through the Gmail interface using 2 syntaxes.
has:yellow-star
orl:^ss_sy
has:blue-star
orl:^ss_sb
has:red-star
orl:^ss_sr
has:orange-star
orl:^ss_so
has:green-star
orl:^ss_sg
has:purple-star
orl:^ss_sp
has:red-bang
orl:^ss_cr
has:yellow-bang
orl:^ss_cy
has:blue-info
orl:^ss_cb
has:orange-guillemet
orl:^ss_co
has:green-check
orl:^ss_cg
has:purple-question
orl:^ss_cp
Superstars and the Gmail.gem
So, using the Gmail .gem, I was delighted to find I can access these specific counts. Here's how:
gmail = Gmail.connect(@email_address, @password)
@red_banged_emails = gmail.inbox.emails(gm: '"l:^ss_cr"')
Or, as I use them
@starred = gmail.inbox.emails(gm: '"l:^ss_cy"')
@requires_my_follow_up = gmail.inbox.emails(gm: '"l:^ss_cr"')
@requires_a_response_from_somebody_else = gmail.inbox.emails(gm: '"l:^ss_co"')
Thanks to Google and Stack Overflow for persisting this knowledge!