As for 'security' (non-spam), I have made this on my contact form. In essence, what happens is that a series of numbers / letters is randomly generated and stored in an array, which is in turn imploded and stored into a $_SESSION[' '] variable. when user fills out and submits the form (including the verification field), the page refreshes itself and checks against all the information submitted. So part of the check is obviously checking against the verification field. So long as the other conditions are correct, if the verification check matches, the form is submitted.
Admittedly, this was a very frustrating part of development. The trick (at least for me), was to have the verification last. It had a lot to do with the flow /structure of everything.. so it goes bascially like this/..once the user enters info and hits, submit, the page refreshes and does the following:
some variables at top of page are set to false (example: emailVerify, messageVerify and finally verifyVerify). Basically, this means guilty till proven innocent so-to-speak
email is checked for valid format.. if so, emailVerify is true
then textmessage is checked.. if valid, messageVerify is true
then finally, at the beginning of the entire verification set, check against user verification..
if false, a new verification is generated and stored into session varaible and awaits submittion to recheck.. if the initial user entry for verification is a match however, verifyVerify is set to true.
Finally, at the bottom , the system checks if all 3 conditions are true (email, message and verify variables).. if so, proceed with the email code we have been discussing in this thread.
It was a heck of a system to work on (lots of pain and suffering).. but I wanted to go through with it for the sake of experience.. I got it working.. but it was tough.. if you don't have the patience to go through with it, there are probably some good custom systems out there that you can use.
Sorry for the long post. Just a lot to explain.
Cheers,
NRG