📜 ⬆️ ⬇️

How does email filtering in gmail work?

General principles of compliance


A simple criterion for verifying compliance is Google search.
You must enter complete words, because There are no derived words (for example, joh will not match john.smith@gmail.com ). The same is true for the plural (for example, the app will not correspond to apps@example.com ).

The word order does not matter if they are not enclosed in quotes (for example, “smith john” will not match john.smith@gmail.com ). As a rule, characters are ignored (see below).

Words are broken apart from letters, numbers and underscores. The most common breakdown characters are +. @ . This means that foo will not match foo_bar@example.com , but will correspond to foo+bar@example.com . The @ sign is not considered a word and may be skipped (for example, “smith gmail” will correspond to john.smith@gmail.com ).

You can use the OR operator in addition to grouping () for some difficult conditions.
')

Character behavior


When you enter characters in the filter window, they usually behave differently:

Other examples of behavior


The default account you use (for example, john.smith@gmail.com ) will match all of your address options if you use a dot , a + sign or a googlemail.com domain in it .

Here is a brief description of each method:

You can combine address submission methods, for example, johnsmith+foo.bar@googlemail.com = john.smith@gmail.com .

Interesting consequences


1. It is impossible to compare all your google addresses that use a dot .
If you have a habit of using a dot in your email address to prevent spam (for example, j.ohn.smith@gmail.com ), then you cannot easily create a filter for all versions of your address with a dot, because in this case they are divided into separate words ( j ohn smith ).
When you have only one option with a dot, it is easy to create a filter (for example, for spam). However, if you start using different options with a dot (for example, jo.hnsmi.th@gmail.com ), this will cause different words to appear in the address (for example, jo hn smi th ), which will force you to create different conditions for each option.

2. The + symbol is worse than the "" operator when comparing addresses with a "+" sign .
If you are trying to create a filter for an address that uses + , it is best to use the full address in the filter (for example, john.smith+foo@gmail.com ).
If, for any reason, you do not use the full address, you should keep in mind that the + operator is actually worse than the "" operator. For example, using john + foo is worse than john foo , since the first option would be foo@john.com .
Keep in mind that the last option is not a panacea, because foo@john.foo.com will be found. He simply guarantees the correct word order. For clarity, you could use "john + foo" , but in reality this is the same as "john foo" .

3. You must use the negation to find all the addresses with "+", to which the mail was sent .
To filter out all addresses that use + (for example, to send them to spam), you should use a request of the form john.smith@gmail.com - "john smith gmail com" . The first part of the query will find all the addresses in which there is a + sign. The second part will remove all addresses in which there are no words in the same order. For example, john.smith+foo@gmail.com will not be found because it has the word foo between other words.
Please note that there is one strange and unlikely case when this will not work: john.smith+john.smith.gmail.com@gmail.com , because it has words in a strictly defined order.

Notes


* - there is a symbol ` , but unfortunately the author does not have it;
** - use without space, because habr formats to habra user.

A source
Related documentation

Source: https://habr.com/ru/post/272359/


All Articles