4

Question:

Is there some setting or workaround for Gmail to highlight an entire line if the email is both unread and from certain people without changing the sort order?


Background:

My company is switching from Microsoft Office to Google. This includes establishing Chrome as the company standard. I'm very used to Outlook and haven't used Gmail in years. I have searched the Chrome Store, SuperUser, WebApps, and the web in general without finding an answer to this.

I rely heavily on conditional formatting in Microsoft Outlook. Any unread emails from my management are shown in a larger-than-normal, bold, red font. Unread emails from purchasing are in a blue font and our receiving inspection group is green. They key points I really like about this approach are:

  1. Important emails call attention to themselves by changing the entire line they appear on instead of just a small icon
  2. Emails remain in order by date received
  3. The color-coding / resizing is automatically applied when it is received
  4. The color-coding / resizing is automatically removed after I read the message

My Own Efforts:

Here's what I have tried in Gmail to recreate this and why each falls short: (My company will no longer use a desktop client so the solution must work in Chrome.)

  • Use filters to apply label "MANAGEMENT" and make it big and red.
  • It's fairly easy to see but not across the entire line. I could live with this, though.
  • It sticks around even after I've read the email which is explicitly not what I want.
  • UPDATE 2017-09-08: This is the solution I have been using thus far. Since Gmail turns the line grey when the message is read, I have somewhat managed to train myself to notice the label + white background. However, they're still much easier to overlook than when the entire line is in bold red text.
  • Use filters to mark them as Important or some star
  • Marking as important gives the same importance for all groups, which won't work.
  • Marking then with stars et al. are not distinctive enough for them to "pop" like I want
  • Use Priority Inbox to show unread messages from management first
  • It throws the emails out of order. If the email chain goes coworker-coworker-boss-coworker, I want to read all those emails to put the boss's in context and also make sure I don't look stupid by repeating things that others said.

Related points that may matter:

  • I don't use Conversation View. For what I want to do, that may make it worse, right? If the boss sends an email and someone else replies to it, it would show up as them in my inbox instead of boss, right?
  • I have Tampermonkey and am comfortable using a script to solve the problem.

UPDATE 2017-09-08

  • As stated above, I've been using filters to apply a preset label "Management" which is bright red. It's been partially effective.
  • Based on a commented suggestion, I tried writing a script to periodically scan my messages and format them. It was unsuccessful because:
    • There doesn't seem to be any way - through a script or otherwise - to change the formatting of an entry in your Gmail inbox.
    • I tried using the script to create a label called "MANAGEMENT UNREAD" plus the subject line of the message. The idea was to create a long, red label that would take up more space on the line and act like a formatted text. However:
      • There doesn't seem to be a way to change the color of a label via Google Script so I can't make it bright red or any other color besides its default.
      • Very long label names are truncated so they can't take up too much space on the line.
  • My next plan is as follows:
    • Create a "Mgt" label and color it gray. This will be short and unobtrusive.
    • Create a "♒♒ MANAGEMENT UNREAD ♒♒" label and color it red. This will be long and more eye-catching. To avoid cluttering this text, I'll refer to it as "MU" label.
    • The filter will label all new messages from management as both "Mgt." and "MU".
    • Write a Google Script with a one minute Installable Trigger that will perform the following:
      • Find all read messages with the label "MU" and remove that label.
      • Find all unread messages with the label "Mgt" and apply the "MU" label. (In case I go back and mark a message as unread to keep it flagged.)
  • This method is currently in place and running. If it proves to be sufficient, I'll migrate this section to an answer (with the code) and accept it just to "close" the question.

It's the dawning of the age of aquarius. U+2652 chosen purely based on appearance.

  • Did you know that you could continue using Outlook as you email client for your Gmail account? I you are using G Suite, you could use Google Apps Sync for MS Outlook to think mail, contacts, calendar tasks... – Rubén Oct 17 '16 at 15:54
  • 1
    @Rubén I would do that except the company will be uninstalling Outlook - along with most of the Office Suite - come January. – Engineer Toast Oct 17 '16 at 16:43
  • 1
    @freginold I'd be interested in a cross-browsing solution just to know if it's possible, but my company established Chrome as the standard browser and do not support any others. In my particular case, therefore, a Chrome-only solution would be sufficient. I have updated the question to reflect this. – Engineer Toast Sep 8 '17 at 12:01
  • 1
    @EngineerToast I'm not terribly familiar with Google App Scripts, but it seems like you should be able to configure that. You can use the Gmail API to listen for when an email is "read" and then remove whatever formatting you'd applied, then refresh the email. – freginold Sep 8 '17 at 14:28
  • 1
    @freginold Google doesn't allow scripts to run continuously in the background so it can't actively monitor Gmail. Sheets, Docs, Forms can be scripts which contain Simple Triggers that fire whenever a certain event occurs but Gmail cannot fire a script whenever an email is received or read. However, a script could be setup to run once a minute using Installable Triggers and that could scan the inbox, formatting as it goes. This is a very interesting idea... – Engineer Toast Sep 8 '17 at 15:08
0

I now have a workaround that solves my particular use case. However, it does not address the overall question of conditionally formatting Gmail. As far as I can tell, there is no direct means to do that without editing the source code for the page and that stuff is a mess. I presume an addon could do it but it's way beyond my scope of knowledge.


In order to achieve the effect I wanted, I followed these steps:

  1. Setup a label in Gmail called "Mgt" and color it gray.

    • The text makes it a tiny label and the color makes it inconspicuous.
    • Its purpose is so I can keep track of all management emails whether they're read or not.
    • It looks like this: Mgt Label
  2. Set Gmail Filters to automatically apply the Mgt Label label to all emails from certain people.

  3. Setup a label in Gmail called "♒♒ Management Unread ♒♒" and color it red.

    • The long text makes it a large label and the color makes it conspicuous.
    • If the text is too long, it is truncated. This length was the max (on my system, at least).
    • The squiggly lines are U+2652 Aquarius, chosen purely on appearance.
    • Its purpose is to make the unread email from management "pop" visually.
    • It looks like this: Unread Label
  4. Write Google Apps Script that searches my Gmail

    • The script is saved on Drive for the same account that's using Gmail
    • It performs the following two actions:
      1. Find all unread messages in Mgt Label and add the label Unread Label.
      2. Find all read messages in Unread Label and remove that label.
    • The code is:
function addRemoveManagementLabelsInGmail() {

  // These labels MUST be setup in Gmail before running this script
  var basicLabelName = 'Mgt';
  var unreadLabelName = '♒♒ MANAGEMENT UNREAD ♒♒';

  // Get the label object
  var unreadLabel = GmailApp.getUserLabelByName(unreadLabelName);

  // Add the label to unread messages
  // You can't change more than 100 labels at a time so, if there are that many, we use the slower method
  var unreadThreads = GmailApp.search('label:' + basicLabelName + ' is:unread');
  if (unreadThreads.length < 100) {
    unreadLabel.addToThreads(unreadThreads);
  } else {
    for (i=0; i<unreadThreads.length; i++) {
      unreadThreads[i].addLabel(unreadLabel);
    } 
  }

  // Remove the label from read messages
  // You can't change more than 100 labels at a time so, if there are that many, we use the slower method
  var readThreads = GmailApp.search('label:' + unreadLabelName + ' is:read');
  if (readThreads.length < 100) {
    unreadLabel.removeFromThreads(readThreads);
  } else {
    for (i=0; i<readThreads.length; i++) {
      readThreads[i].removeLabel(unreadLabel);
    } 
  }

};
  1. Setup an installable trigger on that script so that it runs once a minute.

This is not a perfect system but it does create an obvious visual for me and has, thus far, been effective. My original attempt was just a long "MANAGEMENT" label on all of them but I quickly fatigued since the read messages had just as much apparent importance as the read messages.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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