Spam Filtering with Akismet

Today, spammers target everything. Your contact form is no exception. Contact Form 7 provides several ways to prevent spam, and cooperation with the Akismet spam filtering plugin is an important part of the prevention strategy. In this article, I’ll show you 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 API key.

Next, add the following Akismet-related options into the appropriate fields in your form.

  • akismet:author
    Add this option to the field that accepts the name of the sender.
    Example: [text* your-name akismet:author]
  • akismet:author_email
    Add this option to the field that accepts the email address of the sender.
    Example: [email* your-email akismet:author_email]
  • akismet:author_url
    Add this option to the field that accepts the URL of the sender.
    Example: [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.

response sample

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.

Just another contact form plugin for WordPress. Simple but flexible.

%d bloggers like this: