How gmail email filtering works

    Key compliance principles


    A simple criterion for checking compliance is Google search.
    You must enter full words, as no derived words exist (for example, joh will not match john.smith@gmail.com ). The same is true for the plural (for example, the app will not match apps@example.com ).

    The word order does not matter if it is not enclosed in quotation marks (for example, “smith john” will not match john.smith@gmail.com ). Typically, characters are ignored (see below).

    Words are broken apart from letters, numbers, and underscores. The most common word break characters are +. @ . It means thatfoo will not match foo_bar@example.com , but will match foo+bar@example.com . The @ sign does not count as a word and can be skipped (for example, “smith gmail” will match john.smith@gmail.com ).

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

    Character Behavior


    When you enter characters in the filter window, they usually behave differently:
    • Characters that act like xy : ~ # $% ^ * +; ", <>? And the accent * . For example, smith ~ john becomes smith john , which corresponds to john.smith@gmail.com .
    • Symbols that act as "xy" : - = \: './ . For example, john-smith becomes "john smith" , which corresponds to john.smith@gmail.com .
    • Symbols that are interpreted literally: & _ . For example, john_smith will match john_smith@gmail.com , but not john.smith@gmail.com .
    • Special characters :! @ () [] {} | :
      • ! : john! smith becomes john -smith , which corresponds to john.foo@gmail.com , but not john.smith@gmail.com ;
      • @ :
        • @ is deleted at the end of the word. For example, john @ becomes john , which corresponds to john.smith@gmail.com ;
        • @ is removed at the beginning of the word. For example, @ foo.com ** will become foo.com , which corresponds to john+foo.com@gmail.com ;
        • @ used in the middle of a word usually requires a full address for a successful search. For example, john.smith@gmail will not match john.smith@gmail.com . In addition, characters will be taken literally. For example, to search john.smith@gmail.com you must use john.smith@gmail.com , john-smith@gmail.com and john~smith@gmail.com will not work;
        • @ used in different places in the middle of a word, has strange behavior. For example, when we try to find john.smith@gmail.com , then with:
          • john @ smith @ gmail @ com - not found;
          • gmail @ com - not found;
          • @ gmail @ com - not found ** ;
          • smith @ gmail @ com - there is ;
          • smith@gmail.com - not found;
          • "John smith@gmail.com" - not found;
          • "John.smith@gmail com" - not found;


      • | acts as an OR operator .
      • The brackets are used to group in the OR and AND operators .


    Other behavior examples


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

    Here is a brief description of each method:
    • Using a point : You can enter as many points as you like in your email address. For example, if your address is john.smith@gmail.com , then mail sent to johnsmith@gmail.com will be sent to your address;
    • Using the + sign : After the name of your account, you can use the “ + ” sign and any text. For example, mail sent to john.smith+foo@gmail.com will arrive at john.smith@gmail ;
    • Using googlemail.com domain : Any mail sent to the address of your account type@ googlemail.comwill come to your address with the domain @ gmail.com ** . For example, mail sent to john.smith@googlemail.com will arrive at john.smith@gmail.com .

    The ways of representing the address can be combined with each other, for example, johnsmith+foo.bar@googlemail.com = john.smith@gmail.com .

    Interesting consequences


    1. It is impossible to compare all your Google addresses in which the dot is used .
    If you are in the habit of using a period 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 period, because they are divided in this case 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 variants with a period (for example, jo.hnsmi.th@gmail.com ), this will cause different words to appear in the address (for example, jo hn smi th), which forces 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 some reason, you are not using the full address, then 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 correspond to foo@john.com.
    Keep in mind that the latter option is not a panacea, because will be found foo@john.foo.com . It just guarantees the correct word order. For clarity, you could use john + foo , but in reality it is the same as john foo .

    3. You must use negation to find all addresses with a "+" to which the mail was sent .
    To filter out all addresses that use + (for example, to send them to spam), you should use a query like john.smith@gmail.com - “john smith gmail com” . The first part of the query will find all addresses that have a + sign. The second part will delete 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 specified order.

    Notes


    * - there is a symbol `in mind , but unfortunately the author does not have it;
    ** - use without space, because Habr formats in habrauser.

    Source
    Related Documentation


    Also popular now: