A spam filter is a software designed to process all incoming emails and ensure unsolicited or infected emails never reach your inbox.
Spam is usually detected by analyzing the contents of an email, the credibility of the sender, and the engagement with the emailer, and the sender.