The traditional approach has been using the Blacklists where the email header is taken apart to look at where the mail was sent from and look up on blacklists, if this is a known network or server that has had multiple reports of spam and if so block it. This has been only sort of good.
Spammers constantly switch services and therefore address so they can avoid being caught via a blacklist. Often they leave the service they were using blacklisted and legitimate users of the service cant use mail. Filtering is another way of blacklisting at the destination. The trick is for the computer to look at the words in the email and determine if it is spam. Spammers quickly got around this by adding nonsense letters into the email words to confuse the filters, but the human eye makes sense of the words and the spam is there.
Greylisting is another approach. Often the spammer blasts the email out of their system with little regard to SMTP protocol. So it sends it out and moves on to the next destination email address without checking to see if the recipients mail server bounced it or received it. Greylisting automatically rejects every piece of mail as a real mail system will check to see what the receiving mail server is doing. The greylist issues a temporary rejection and stores the ip address of the sender. A real mail server will retry 5 to 10 minutes later and is then accepted by the recipients mail server.