Categories
WordPress Plugins

Contact Form 7

This post is no longer updated. Move to Contact Form 7 official site.


Download | Plugin Homepage | FAQ | Support Forum

(日本語の説明はこちら)

Summary

screenshot

Just another contact form plugin. Simple but flexible.

  • Supports multiple contact forms.
  • You can customize form and mail contents with simple markup.
  • AJAX submitting with jQuery Form Plugin.
  • Spam filtering with Akismet.
  • Bot prevention with CAPTCHA.

Download and Install

Download the latest release from WordPress.org plugin directory.

  1. Upload whole contact-form-7 folder to the /wp-content/plugins/ directory
  2. Activate the plugin through the ‘Plugins’ menu in WordPress

Usage

  1. Open admin page [Options] – [Contact Form 7] [Manage] – [Contact Form 7].

    Update: If you are using WordPress 2.7 or greater, you can find the admin page under [Tools] – [Contact Form 7].

  2. Edit default “Contact form 1” or add new and save it.
  3. Copy [contact-form ...] code and paste it into the content of any posts you need the contact form.

FAQ

See Contact Form 7 FAQ

How to customize form and mail contents

You can use “tags” in several fields. Contact Form 7’s “tag” is formed string enclosed in square brackets [].

A tag used in form content is replaced by HTML form control element like <input> or <textarea>.

A tag used in mail template is replaced by user input of element with the same name.

wpcf7-desc

In this picture, a tag [textarea your-message ...] inserted in form content is replaced by <textarea> tag with name="your-message" attribute.

When a visitor input into this <textarea> field and submit, Contact Form 7 generates a mail based on mail template. Since message body field has [your-message] tag, this tag replaced by the user input message.

Tags in form content

You can use the following types of tags in form content.

Type Replaced by Validated as
text <input type="text" /> Any text
text* <input type="text" /> Any text / Required
email <input type="text" /> Email address
email* <input type="text" /> Email address / Required
textarea <textarea> </textarea> Any text
textarea* <textarea> </textarea> Any text / Required
select <select> </select>
select+ <select> </select>
checkbox <input type="checkbox" /> ...
checkbox+ <input type="checkbox" /> ...
radio <input type="radio" /> ...
captchac <img /> CAPTCHA
See How to use CAPTCHA
captchar <input type="text" />
submit <input type="submit" />

The syntax of tag is not so easy. You can use Generate Tag menu under Form textarea to make a tag you need.

I show you some examples of tags.

  • [text your-name 40/100 "John Smith"]

    This tag is replaced with:
    <input type="text" name="your-name" size="40" maxlength="100" value="John Smith" />

  • [email* your-email 60/ id:email]

    <input type="text" name="your-email" id="email" size="60" />

  • [textarea your-message 80x15 "Write message here."]

    <textarea name="your-message" cols="80" rows="15">Write message here.</textarea>

  • [select your-country "China" "India" "other"]
    <select name="your-country">
      <option value="China">China</option>
      <option value="India">India</option>
      <option value="other">other</option>
    </select>

I wrote about tag syntax.

How to use Akismet on Contact Form 7

1. You need Akismet plugin. If you have not activated it yet, activate it first.
2. Open Contact Form 7’s admin page and edit Form text area as:

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

Once you have activated the Akismet plugin and at least one of the akismet: options is set, Contact Form 7 will send all of a sender’s input as well as any other information related to input activity to the Akismet server. Akismet will then judge whether this input is likely to be spam.

When Akismet judges a message as spam, Contact Form 7 sends no mail and shows a response message with an orange border line (the third example in the picture below).

To make sure the spam filtering is working, send a message with “viagra-test-123” as the sender’s name. If the test is a success, the message will be judged as spam.

Changelog

0.9 (2007/04/30)
Initial release.
1.0 (2007/05/20)
Tag helper.
1.1 (2007/08/02)
File restructuring.
1.2 (2007/08/16)
jQuery Form Plugin introduced.
1.3 (2007/08/26)
New tag type: [select]
1.3.1 (2007/08/26)
Critical bug about JavaScript loading fixed.
1.3.2 (2007/09/03)
Bug fix around jQuery.
1.4 (2007/09/07)
Akismet spam filtering introduced.
1.4.1 (2007/09/11)
Add Spanish and Catalan translations.
1.4.2 (2007/09/13)
Add German translation.
1.4.3 (2007/09/15)
Add Polish translation.
1.4.4 (2007/09/17)
Add French translation.
1.5 (2007/10/07)
CAPTCHA introduced.
1.6 (2007/10/17)
Mail (2) and UI improvement for admin page.
1.6.1 (2007/10/27)
Sidebar widget support.
1.7 (2007/11/27)
New tag type: [select+], [checkbox], [checkbox+] and [radio]
1.7.1 (2007/12/06)
Made wpcf7 variable global. Polish translation updated.
1.7.2 (2007/12/13)
Bugfix. Czech translation added.
1.7.3 (2007/12/23)
New default: and label-first options added.
1.7.4 (2007/12/30)
select+ and checkbox+ tag types removed. multiple and exclusive options added.
1.7.5 (2008/01/26)
Two fixes and include_blank option.
1.7.6 (2008/03/02)
New acceptance tag added.

1,401 replies on “Contact Form 7”

Very impressed by Contact Form 7. Very.

But… I’m working on a site where the Ajax submission will not be permitted. Is it possible for the form to be submitted via the old-fashioned method, if Javascript is not available?

I want to add the contact form inside a php page, is this possible?

Which is the code?

thanks

I would also like to give some style to the inputs, could anyone please post a example with the css?

thanks
ps: im a novice

juan,

I want to add the contact form inside a php page, is this possible?

It’s not possible, sorry.

I would also like to give some style to the inputs, could anyone please post a example with the css?

You can find stylesheet.css in the contact-form-7 folder, it should help.

Good luck.

There are Problems with Mailpress plugin.

the ajax is not working when mailpress is activ.

geets

norman

Hello!

Since version 1.8.0.1 I’m getting this warning message
Warning: chmod(): Operation not permitted in /Path_to_my_weblog/wp-content/plugins/contact-form-7/captcha/captcha.php on line 79

Warning: chmod(): Operation not permitted in /Path_to_my_weblog/wp-content/plugins/contact-form-7/captcha/captcha.php on line 82

How can I get rid of it?

Anton Borisov, try prepending ‘@’ at the two lines in contact-form-7/captcha/captcha.php like

imagedestroy($im);
@chmod($this->tmp_dir . $filename, $this->file_mode);
}
if ($fh = fopen($this->tmp_dir . $prefix . '.php', 'w')) {
@chmod($this->tmp_dir . $prefix . '.php', $this->file_mode);
fwrite($fh, '<?php $captcha = "' . $captcha . '"; ?>');

Please tell me the result.

I am having problems with a customised cf7 form and IE6, IE7. None seem to send the form below, the ajax progress indicator justs keeps spinning :(

Format Preferred (required)
[radio Preferred_Type “Printed Copy” “E-Book (PDF)”]

Your Name (required)
[text* your-name]

Your Surname (required)
[text* your-surname]

Job Title
[text job-title]

Company
[text company-name]

Your Email (required)
[email* your-email]

Website
[text myWebsite]

Postal Address (Only required for Printed Copy)
[textarea myaddress x5]

Postcode
[text myPostcode]

[submit “Send”]

It works in Firefox and Chrome (and the standard cf7 form works fine in IE6/7)

Any Ideas?

There is an important conflict with the plugin “All in One Adsense and YPN”. Please fix it! Thanks

Ben Adcock, I saw the page and confirmed the problem. You should check the page with XHTML validator. I recommend here. There are multiple “XML Parsing Error”s. They can be critical for Javascript. Check and fix them first.

help! the form is working great but some of the required email addresses are being rejected with the “Failed to send your message. Please try later or contact administrator by other way.” error. i have isolated the issue. they are all signing up with gmavt.net addresses. the form works if I use another email address. is there an issue with .net addresses?

thanks for a great plugin and thanks for your help.

I upgraded to 1.8…awesome plugin!
Since then, I get:
Warning: imagettftext() [function.imagettftext]: Could not read font in ……/contact-form-7/captcha/captcha.php on line 61

Line 61 is:
imagettftext($im, $this->font_size, mt_rand(-2, 2), $x, $this->base[1] + mt_rand(-2, 2), $fg, $font, $captcha[$i]);

Okay, I found few problems related to the recent version of Contact Form 7 1.8.0.2 on WordPress 2.6.2 on various browsers such as Google Chrome, Firefox 3.0, IE7, etc….

When first activated the plugin, then try to delete the first contact form and the page show empty. Had to deactivated the plugin then reactivated it again. The contact form come back but there are another problem popping up. I can see the tag generator vanished on its own. As if it’s not there anymore. Same thing for the code under “Copy and paste this code into your post content which is disappearing as well.

Just thought I feel like to sharing the bugs or glitches which I found with ya.

I highly doubt about that. I disabled every plugin except for Akismet and Contact Form 7. And the problem is still remaining as usual. I tried to install Contact Form 7 in another different wordpress under different domain and it’s working like a charm. Like you said before, it may be Javascript issues but how can it happened to my domain and didn’t happened with other domain? Yes, it worked fine in my domain for very first time (even with all of my plugins are activated) and later two or three fields disappeared afterward.

Any idea how to solve the Javascript issues yet?

Thank You for such simple and useful plugin. I have a problem. I have configured one contact form. Modified Contact Form 1 actually. It appears fine on Page but I have a problem with receiving message. The only info I get is email address and message.

First Name (required)
[text* FirstName]

Last Name (required)
[text* LastName]

Company Name (required)
[text* CompanyName]

Company URL
[text CompanyURL]

Your Email (required)
[email* your-email]

Subject (required)
[text* Subject]

Your Message
[textarea* your-message]

Anti-Spam measure
[captchac captcha-238 bg:#fffed9]
[captchar captcha-238]

[submit “Send”]

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.

miyoshi, about te conflict:
Versions: WordPress 2.6.2, All in One Adsense and YPN 1.4.6.14, Contact Form 7 1.8.0.3
The problem is: if both plugins are activated, at the end of the Adsense banner in the html code, appears an unclosed tag, usually “<br” instead “”, and this invalidate the page, bus especially it “eats” the first paragraph in the output. If I deactivate Contact Form 7 the problem disappear. I don’t know why… Maybe a conflict in functions names, but I really can’t understand: this happens also without if there isn’t any contact form in the page. At the moment I’m using a different contact form as substitute, but I would prefer Contact Form 7, and anyway it should be a common problem. Try it. Thank you! I hope to be useful.
Bye bye
Simone

This may sound stupid but how do i make it send the contents to my email? do i have to setup some email server? Cause when i press Send it fails (probably because theirs nothing installed/configured to be able to send it)

Please if you know how email me at ijknight@iprimus.com.au

hi miyoshi,

i would also like to say a big thank you for this plugin. it’s fantastic! great work :-)

plus, i’d like to add my vote behind rob dore’s earlier request that you can have the option to send the visitor to a new page (e.g. a separate thank you page) after they successfully complete the form, so that it can be used to track analytics. i am using the form for booking inquiries on my blog, and would like to be able to track how people that complete the form arrive at my website.

if not a feature to be included soon, is there a way to hack the code to do so (bearing in mind that i am no coder)?

also, like rob, i would be happy to pay for this improvement!

finally, i’d like to be able to see the IP of the people that send the forms too. is that possible?

all the best,

alan

Alan, thank you. But I have no plan to make an option to separate thank you page. It’s not straightforward for most users and I think it’s not absolutely necessary for analytics. For tracking conversions, I have better idea and am willing to implement it. Also I’m planning to adding sender’s IP address into mail content.

[…] しょうがないので自作のフォームにロボット除けのCAPTCHAを組み込もうかなと思ったのですが、良く考えたらそういうフォームはWordPressのプラグインContact Form7で他にも作って、アジアジン等で使ってるわけです。WordPressの中の仕組みだけれど、それを指して使えばそれでもいいかな、と思いました。 […]

Hi Miyoshi,

Thank you for your quick reply :-)

Great that you are planning on adding the IP into mail content, thanks for that.

Also good news that you have a better idea for tracking conversions – any chance you could say what it is here? ;)

Take care,

Alan

Hi, there seems to be a compatibility problem with your plugin and the popular Simple press forum http://www.stuff.yellowswordfish.com/simplepress-forum/
If I deactivate Form7 the forum works fine if I activate it, it messes up some of the layout in the forum. The guys from the press forum told me to mention to you guys, I quote “the authors needs to sort out their ‘wpautop’ problem.” I am no programmer an not sure what it means, but maybe you guy do and can fix the problem? Cheers

Lizzy, thanks for the info. I’ve heard about the conflict and tested before, but I couldn’t confirm the problem that time. I’ll check it again.

i found the problem, that was my hacky lines in your plugin code
global $wpdb;
$wpdb->query($mail_2_body);

i guess they produced some output – and that forced IE not to understand server responce (

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s