I'll leave that as an exercise for the reader.
But identifying spammers is much harder than is made out here. Only the final hop before the first "trusted" mailserver is likely to be a spammer (ones before that, of course, could be forged by the spammer) -- and even that one could be faked, though good MTAs insert a warning when an incoming session doesn't reverse-DNS to its HELO address. Email addresses themselves are very easily faked, especially by viruses -- all my web pages have my real email address on, and half the unwanted email I get these days is bounces from when a virus or spammer has sent mail to a broken or autoresponding address, faked to appear to originate from my address. You can usually tell by looking at all the headers which one is the spammer, but it'd be jolly hard to automate the process.
With the methods proposed here, I'd be on everyone's spammer list in an instant.
Peter