A spam filter relies on a complex algorithm to calculate the spam score of every email that arrives at the destination server. It considers a number of different factors, including how people have treated emails from this sender in the past, the message's subject and body, and the source IP's reputation.