I released Contact Form 7 1.5. You can use CAPTCHA on it. Russian and Brazilian Portuguese translations came in. Akismet’s usage got changed as it was confusable.

(日本語はこちら)

Before using CAPTCHA

  • You need GD and FreeType library installed on your server.
  • Make sure contact-form-7/captcha/tmp wp-contents/uploads/wpcf7_captcha folder is writable. (*1)
  • CAPTCHA does not give you 100% security.

*1 — Contact Form 7 1.8 and later use wp-contents/uploads/wpcf7_captcha as image folder.

How to use CAPTCHA

To add a CAPTCHA into your contact form, use [captchac] and [captchar] tags in the form content field in Contact Form 7’s admin page.

[captchac] means CAPTCHA-Challenge and it is replaced by an <img> element for CAPTCHA’s image. [captchar] means CAPTCHA-Response and it is replaced by an <input> element for an input field.

A [captchac] must be paired with a [captchar] with the same name. For example, tags shown below are valid.

[captchac captcha-1] [captchar captcha-1]

And your browser renders them as shown below.

I show you another as a bad example.

[captchac captcha-2] [captchar captcha-3]

They are invalid as having different names. In this case, your browser renders them as above, but the CAPTCHA never matches.

Options for [captchac] and [captchar]

To change the foreground color of a CAPTCHA, use fg option with [captchac]. Put RGB color code in hex format after fg:#. For example, set fg:#ff0000 if you want red foreground.

In the same way, use bg option to change the background color.

To change the size of a CAPTCHA, use size option with [captchac]. Only size:s (60×20), size:m (72×24) and size:l (84×28) are available. If you don’t set size option, size:m is used as default.

I show you some examples.

  • [captchac captcha-1 size:s fg:#ffffff bg:#000000]
  • [captchac captcha-1 size:l fg:#33ff99 bg:#223399]

To change the size of an input field, use size/maxlength option with [captchar].

For example, if you want an input field with 40 as size and 100 as max length, add a tag shown below.

[captchar captcha-1 40/100]

And all available options for [text] are also available for [captchar].

Russian and Brazilian Portuguese translations

Russian (by Dmitry Volotovich) and Brazilian Portuguese (by Leonardo Pinheiro) translations came in. Thank you very much!

Now Contact Form 7 has translations in the following languages.

  • Brazilian Portuguese
  • Catalan
  • French
  • German
  • Italian
  • Japanese
  • Polish
  • Russian
  • Spanish

If you have a translation in a language not listed above, please let me know.

New usage of Akismet

Since I released Contact Form 7 1.4, I have got a ton of messages from users saying that Contact Form 7 stop sending mails after they turned on Akismet option on it. In most cases, the problem was that they have not added necessary options (akismet:author, akismet:author_email and akismet:author_url) for using Akismet properly.

I considered the fact that so many users got confused, and decided to change the usage.

Contact Form 7 1.5 always sends information to Akismet server if:

  1. You have activated Akismet plugin, and
  2. You have added at least one of options for Akismet (akismet:author, akismet:author_email and akismet:author_url).

I removed Apply Akismet checkbox from admin page as it is not necessary anymore.

For beginners, I show you how to use Akismet on Contact Form 7.

Step 1. You need Akismet plugin. If you have not activated it yet, activate it first.

Step 2. Open Contact Form 7’s admin page and edit form content field as:

  1. Add akismet:author option to the tag of field which requires sender’s name.
    Example: [text* your-name akismet:author]
  2. Add akismet:author_email option to the tag of field which requires sender’s email address.
    Example: [email* your-email akismet:author_email]
  3. Add akismet:author_url option to the tag of field which requires sender’s URL.
    Example: [text your-url akismet:author_url]

That’s all.

Sender’s all input and many other information related to the inputting activity are sent to Akismet server. Then Akismet judges whether it is likely to be a spam.

See also: How to use Akismet on Contact Form 7 (Contact Form 7 1.4 release announcement; available except outdated Step 1-3)


Comments

74 responses to “Contact Form 7 1.5”

  1. what is that with sender’s URL? – the contact form 7 *does not* have such a field but you make it a requirement? as a result the form no longer sends with akismet enabled!

  2. Akismet is designed for comments. A comment has fields for author’s name, author’s email and author’s URL. In case they are empty, Akismet may think “this comment seems a spam”. It may not think so. I don’t know.

    Contact Form 7 doesn’t know which field is for author’s name, author’s email and author’s URL. If you don’t tell it, which field’s value should it send to Akismet? Do you have any suggestions?

  3. Well, form7 version 1.4 seemed to have worked with just

    email
    author

    you sure akismet URL is compulsorily *required* to be submitted?

    I mean it really makes no sense to create such a field in form7 when most visitors won’t fill it out.

  4. It is a matter of Akismet. I don’t know at all how Akismet distinguishes a spam. Contact Form 7 does just send info to Akismet. Ask Akismet developer.

  5. Reading here under Comment Check

    http://akismet.com/development/api/

    field names look quite different and required are only the first three fields not mentioned here.

    comment_author
    Submitted name with the comment
    comment_author_email
    Submitted email address
    comment_content
    The content that was submitted.

    To me it looks like these three field names above are doing it for form7. However, I am not into this :)

  6. Ok, I changed the form content to:

    Your Name
    [text* your-name akismet:comment_author]

    Your Email
    [email* your-email akismet:comment_author_email]

    Your Subject
    [text your-subject]

    Your Message
    [textarea your-message akismet:comment_content]

    [submit “Send”]

    and send was successful! maybe this is doing the trick?

  7. Good.

    But on current version, Contact Form 7 concatenates all field value into a string and send Akismet it as comment_content. As a spammer can do spam on every field, you know. So you can remove akismet:comment_content.

    If you test whether it is working, submit the form with viagra-test-123 as Your Name. It must be judged as spam always.

  8. Nope, test fails! Viagra no spam?

  9. If you saw result message with orange border, it meaned spam.

    Green border: sent successfully
    Red border: really failed to sent (mail server problem)
    Orange border: spam, not sent

  10. thanks for the info. I see a *green* border (sent successful) even I have viagra in every field :/

    something is seriously wrong..

  11. Ah, I got it.

    akismet:comment_author
    -> akismet:author

    akismet:comment_author_email
    -> akismet:author_email

  12. works now *after* I downloaded/re-installed the Akismet plug-in. Weired!

  13. have dumped Akismet – extremely unreliable service!

  14. I am getting the following error when I put Captcha on my form:

    Fatal error: Call to undefined function: imagettftext() in /home/meadpt/public_html/alyoung/wp-content/plugins/contact-form-7/captcha/captcha.php on line 60

    I did set the TMP file to writeable. Any idea why this is not working?

    – nice plugin! -Bill

  15. Bill,

    Is GD library installed on your server?

  16. Hallo,
    i’ve got a problem with the Captcha feature!! I’d like to get a captcha with a blue background and green letters, as you did in the samples.
    I don’t know where to change the code! Which file?
    the file wp-contact-form-7.php has array input! Where should i change something?

    thanks

  17. lara,

    Sorry for my poor documentation. You don’t need to edit files at all. Just 1) login to WordPress admin panel, 2) move to Options » Contact Form 7, 3) click a link in main block (the left one) then contact form settings is opend up, 4) find a textarea labeled “Form”, 5) enter [captchac captcha-1 size:l fg:#33ff99 bg:#223399] and [captchar captcha-1 40/100] into the textarea, and 6) click “Save” button at the bottom. See the plugin page.

  18. Hi Miyoshi,
    thank you!! I followed your instructions and it worked!!

    Thanks again!

  19. Hi, I cannot get the captcha to work. I am running FC6 and have GD & freetype installed. The error I get is:
    HP Fatal error: Call to undefined function imagetypes()
    Any thoughts?

    Thanks,
    JJ

  20. Fixed, I was missing the php-gd rpm.
    Thanks for such a cool form tool!

  21. hi, this is the best form! easily customizable to suit your needs! I have a question, though: Is it possible to load jquery only on pages that include a contact form to minimize the page size?

  22. docflo,

    So far this plugin does not offer the way you wrote, but some users do a hack to remove the filter from pages with no contact form. This should do what you need.

    https://ideasilo.wordpress.com/2007/04/30/contact-form-7/#comment-5429

  23. thanks for the reply!

    but your solution doesn’t work , I’m afraid…

    I added

    but it still loads the js.

  24. Oh, the code got stripped away… anyway: I added the code…

  25. i have to say you made a great plug-in! but i’m having a problem with the captcha thing on my site…

    for some reason the captcha code is shown in uppercase but it only validates when i type the code in lowercase…

    any idea where this problem could be originating from and how to fix it ?

    thanx and greetings,
    i.am.doom

  26. iamdoom,

    Tha captcha accepts both uppercase/lowercase by ordinary. Something happening on your environment.

    But, I saw your form page and did some testing, and I couldn’t find any problems there. It validated uppercase/lowercase correctly as I expected.

    It may be a client-side issue. What browser are you using? I’m using Firefox.

  27. ieproblem Avatar
    ieproblem

    hello,

    I test the default form with firefox and it working fine but not IE7, when hit the submit the loading icon keep loading and no sending message appear and also no email sent… any helps? Thanks

  28. ieproblem,

    1) Check your HTML with validator, like HTML-CSS Validator
    2) Make sure there are no other plugins conflicting

    From my experience, the most possible cause is invalid HTML.

  29. sir,
    1 the captcha works in IE but not in firefox (you cannot enter anything in the block.

    2 Please accept the terms to proceed.
    When i click “submit” i get the above “Please accept the terms to proceed.” message and the message is not sent!!
    What must I do to fix the problem?

    Kind regards
    Charles van Eeden

  30. CAPTCHA does work in Firefox, however users have to click and hold their cursor inside the response field while typing the captcha. Would be cool to get a fix on that.

  31. Charles,

    1 I guess you are misusing <label>. Try removing it.

    2 There was a known issue about that. Upgrade to 1.7.6.1 and try again.

  32. Dear miyoshi,

    thank you for a good plugin, but after I upgraded to version 1.7.7 captcha stopped working. I have the tmp folder set to 777. It displays an ’empty’ image and then the response field.

    Do you know what is wrong?

    peace
    morsi

  33. morsi,

    I have no idea why captcha is not working on your site. I didn’t change any code about captcha in 1.7.7, and captcha is working on my site with 1.7.7. Have you seen the PHP error log?

  34. Same here,
    upgraded to 1.7.7. on 2.5 installation and captcha stopped working. Even after chmod 777 for the entire captcha folder. The image room remained blank, even after changing and testing several new colors and forms.

  35. Solved it. The plugin had been automatically upgraded from the WP Dashboard. I deleted the whole folder, reloaded all the unzipped stuff through ftp, set the tmp folder to 777 et voilá.
    Great job you did, thanx.

  36. When testing the plugin v1.7.7 on wordpress 2.5 with the Apple versions of the browser Firefox and Safari it gave strange results –> Safari (mac) cannot display the Captcha-image and Firefox just displays the word “captcha” . any ideas?

  37. Hans, thank you for the good info. I’ll consider a revision for that.

  38. lazarus Avatar
    lazarus

    Thank you for a great plugin. I would like to make the captcha be 5 characters instead of 4. Is this possible?

  39. lazarus, yes, it’s possible. But you have to edit PHP codes manually. All captcha-related stuff is managed within contact-form-7/captcha/captcha.php. You’ll find the line in the file setting char_length as 4. Rewrite it to 5. You’ll have to change the other size options (img_size, base, font_size and font_char_width) as well to keep the captcha readable.

  40. […] Speaking of CAPTCHA, if you plan on using this security feature with Contact Form 7, be sure to read this article to make sure you have the proper things installed on your webserver to use the CAPTCHA image […]

  41. Henrique Avatar
    Henrique

    Great plugin! Very functional and easy to use!

    It might be worth having a note in the docs about not using the captcha tags inside a – I was having the same focus problem on Firefox until I found the answer in the comments ^^’

    Domo arigato gozaimasu! ^^v

  42. Henrique Avatar
    Henrique

    ops, I meant “using the captcha tags inside a <label>”

  43. Henrique Avatar
    Henrique

    Sorry, one more suggestion.. I can’t get a proper alignment between the challenge image and the text field, so I was thinking it would be nice if you could add alignment options to the [captchac] tag (like ‘absmiddle’ and ‘middle’).

    Thanks again!

  44. Captchas are often hard to translate even by humans, better a word or question-answer test.

  45. Great stuff, In my case I was forced to add both fg and bg colors to make the CAPTCHA visible. Without them it just showed a black box. The only problem I still have is that the used captcha png and php files in the tmp directory are not removed. It fills up slowly but steadily. Any suggestions? (using 1.7.7.1)
    Another point, I would like to make some contactforms only accessable when the user is logged in. Can that be done somewhere?

    Thanks again.
    It’s the most versatile contactform I have seen sofar.

  46. Love the versatility of CF7, but I just can’t get it to work. I’m getting the green-box ‘success’ message, but none of the emails are getting through. Tried swapping ‘wp_mail’ for ‘mail’ as suggested but that didn’t work either.

    My hosting company – Fasthosts – tells me, via their technical support pages, that in order to send email via web-form from a domain on my account, I have to incorporate the following code:

    Where user@yourdomain.com is an email address set up on my hosting account.

    Is there any chance that this is preventing the emails reaching their destination? And if so, do you have any idea how and where do I might include it?

    I’d be very grateful indeed for any advice you could offer.

  47. Sorry! The code (within a php function) should be:

    ini_set(“sendmail_from”, ” user@yourdomain.com “);
    mail($email_to, $email_subject, $email_message, $headers, ‘-f’user@yourdomain.com);

  48. Darren T,

    Is there any chance that this is preventing the emails reaching their destination?

    Yes, I think so.

    And if so, do you have any idea how and where do I might include it?

    You should do it in wp_mail() in wp-includes/pluggable.php. Inserting a line $phpmailer->Sender = 'user@yourdomain.com'; might work. There may be a plugin to do that, but I’m not sure.

  49. miyoshi,

    I wonder if it’s possible to increase the number of characters in captcha instead of set 4 characters in captcha as a default. If so, I would like to have one on my weblog in future if possible. Thanks.

  50. LeviathanC, it’s possible. You can do it by setting parameters in captcha/captcha.php (they are reset in wp-contact-form-7.php, so you should edit it). Uh, but … it’s little bit tangled, though.

Leave a comment