I’ve had several clients complain about getting spam through their contact forms. Initially, I tried checking the referrers to make sure the comments were being submitted from a browser rather than just a bot, but that didn’t help enough. Luckily, many people have created libraries for Akismet, the anti-spam service that WordPress uses. I setup the contact form to use Bret Kuhns’ PHP4 class, which submits the comment to Akismet’s service and lets you know if it’s spam or not. There are several other libraries available, including ones for PHP5, Python, Java, Ruby on Rails and .NET2.