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?
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:
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"
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 remove a label, you will not be able to accomplish this via filters.
Potential workarounds would be:
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.
Google recently introduced a new scripting framework for Google Apps.
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.
Then a new step 3 would be to catch those emails using the
deliveredto:email@example.com 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.
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.
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.