Take the 2-minute tour ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

I have a couple on-going conversation threads in Gmail with a number of different people. Is there a way to setup a filter so that it will add a label if the body of any new, unread email contains my name? Then remove the label once I've read the email?

share|improve this question

migrated from superuser.com Aug 26 '11 at 17:28

This question came from our site for computer enthusiasts and power users.

3 Answers 3

up vote 7 down vote accepted

Remember that you can use any gmail search operator in a filter via the Has the words: textbox since gmail just AND's together the operators that are filled in via the filter dialog.

I'll suggest you start by trying this:

  1. Create a filter that finds new emails with your name in them and applies a temporary label. The search operation you would use in the filter is:

    is:unread AND body:"Your Name"

  2. Create a filter that finds read emails in the temporary label and removes the label.

    label:templabel AND is:read

    Unfortunately, while filters can operate on read emails, they cannot currently remove labels, we are at a stopping point.

-

Sorry can't help more, but until gmail filters can unapply a label, you will not be able to accomplish this via filters.

Potential work arounds would be:

  1. Setup an IMAP client with the equivalent filtering where instead of adding/removing a temporary label you would be copying/deleting the email from the temporary folder.

  2. Google recently introduced a new scripting framework for Google Apps.

  3. One really crude hack for step 2 would be to have the filter forward the email as well as delete it. You would forward to your own email address with a plus extension, e.g. username+templabelname@gmail.com.

    Then a new step 3 would be to catch those emails using the deliveredto:username+templabel@gmail.com search string, and reapply some label.

    Not sure how cleanly this method would work, especially because you would get header cruft from the forward (vs. redirecting).

Personally, I would look at #2 since learning scripting for Google Apps would pay off in the long run.

share|improve this answer

The first part: adding a label based on existing keyword is simple, but the second part I think is impossible, because there is no such trigger in Gmail that could cause a filtering operation once an e-mail is read.

share|improve this answer

There is no search operator to restrict to the body of a message. I would recommend setting up a filter with your name in the "Has the words" field, and apply the label as your action. There is no need to add "is:unread" because filters apply to incoming messages.

Likewise you cannot remove the label via filter or take automatic action after the message has arrived. But there are a few other options that might help:

  • Use keyboard shortcuts to remove the label when you finish reading the message. Assuming you are reading the messages from label view, "y" will remove the label, and "[" and "]" will remove the label and move you to the next or previous message.
  • Use the Hide read labels lab to hide the label if there are no unread messages inside.

Finally, you could also consider setting up a Quick Link or a Multiple Inbox with the search query: is:unread yourname. The link or inbox would automatically update and remove messages from the view after you read them.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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