15

How do I filter out Gmail messages that DO NOT have attachments?

Here is the documentation I'm trying to follow.

I can see that in order to include messages with attachments, I use the following query:

has:attachment

However, I do not see a way to do the inverse. I seek something like:

!has:attachment

What am I missing?

Let Me Tink About It
  • 15,156
  • 21
  • 98
  • 207
  • 1
    How about using `-has:attachment` by adding `-`? `-` is used as NOT. [Ref](https://support.google.com/mail/answer/7190?hl=en) – Tanaike Nov 28 '19 at 06:46
  • @Tanaike That's what I think too, but there's no specific reference for that in the documentation _except_ "Remove messages from your results". Is that the relevant rule? – Tedinoz Nov 28 '19 at 10:06
  • @Tedinoz I couldn't find the clearly document for this. I have used this operator from [this document](https://support.google.com/mail/answer/7190?hl=en), because I thought that in Japanese language, I could understand like `specify keywords to exclude from search results`. By this, I thought that `-` can be used as NOT. But if this was not the replying you expect, I have to apologize. – Tanaike Nov 28 '19 at 11:47

2 Answers2

19

Summary from comments

Both of the following work:

!has:attachment

and

-has:attachment
Let Me Tink About It
  • 15,156
  • 21
  • 98
  • 207
  • It didn't work when I need to search for emails belonging to a label with no attachments. To fix the issue I used **label: (has: !attachment)**. And it worked. – Ravi Jun 21 '22 at 15:44
0

I couldn't find any arguments for not having an attachment, but there is one for not having a user label. So you could have it filter select messages with attachments to an attachment label and have the select messages without a user label go somewhere else.

For Example: These two filters will delete messages forwarded from google voice if they don't have an attachment.

  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community May 26 '22 at 06:43