Gmail has a powerful filter feature that can be used to filter existing and incoming emails based on various parameters. For instance, we can filter emails by the subject, sender, recipient ( if you use different addresses / aliases with your account) or even to block emails not in your Google contacts.
In the case of filtering by the sender, we usually only need to filter the emails by one email address, e.g. [email protected]. In some cases you may however want to filter all the emails from a specific domain instead, e.g. all emails from the domain example.com.
This can be very useful if you happen to receive important emails from a particular organization or business and need to filter all their emails temporarily or permanently. In the latter case, we only need to create a filter which automatically filters all their emails on arrival. Here’s how to go about it.
Filter Temporarily
In the Gmail search box enter the search term from:@example.com
(where example.com is your target domain) then press the Enter key. Doing this will filter out all the existing emails in your inbox that match the search and show them just below the search box.

Alternatively, you can first click on the gear button at the end of the search box to reveal the search options. Thereafter, enter only @example.com
in the From box, then click the Search button to run the filter.

Make sure that the Date range is set to None if you want to search in all your mail regardless of the date.

Apply and Save Filter for Emails from a Specific Domain
This will save the filter for all future emails coming from that domain and attach a specific action on what to do with the emails.
To do this, first conduct a search as shown in the last point and confirm that it’s working properly. After that, click on the Create filter button, then select an action for the filter.
For instance, you can apply a specific label or category to all emails that match that criteria. New labels can be created by going to Gmail Settings > Labels. Make sure to enable the option Show in IMAP if you need to access the label / folder in an email client like Outlook or Thunderbird.
Other actions you could try are Never Send it to Spam in case you’ve noticed the emails are going to the Spam folder, or even Forward them to a different email address.
On the other hand, you can also use the filter to block emails from the domain if perhaps they’re spamming you. In this case, you can either use the Delete it action which will automatically trash the emails on arrival or Skip the Inbox to archive the emails.
Note: Make sure to check the option ‘Also apply filter to # matching conversations‘ to include existing emails from the domain in the action.
Should you no longer need the filter, you can always delete it by going to Gmail Settings > Filters and blocked addresses.