Today, spammers target everything. Your website contact form is no exception. Adding Google Captcha or one of the many captcha plugins for WordPress will usually solve this, but there times when you might not want to use captcha at all.
Contact Form 7 (probably the most popular contact form for WordPress) provides several ways to prevent spam, and cooperation with the Akismet spam filtering plugin is an important part of the prevention strategy. Here’s how to implement Akismet on your contact form.
First, you need to activate the Akismet. Akismet is comes automatically installed out-of-the-box so you just need to activate it and set up a WordPress.com API key.
Next, add the following Akismet-related options into the appropriate fields in your form.
Add this option to the field that accepts the name of the sender.
[text* your-name akismet:author]
Add this option to the field that accepts the email address of the sender.
[email* your-email akismet:author_email]
Add this option to the field that accepts the URL of the sender.
[text your-url akismet:author_url]
When at least one of those options are set (remember, it’s recommended to set all of the options for accurate judgment), Contact Form 7 will send Akismet all of the sender’s input and the information relating to the submitting activity. Akismet will then judge whether this submission is likely to be spam.
If Akismet judges the submission as spam, Contact Form 7 cancels the sending of mails and shows a message that says, “it failed to send the message.” You’ll see an orange border around the response message when it has been judged as spam.
Finally, to make sure it works, you can test it by sending “viagra-test-123” as name of the sender. This test case will always be judged as spam.