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”

The captcha’s jsut show up as captcha so I installed your Really Simple CAPTCHA it still doesn’t show up and I have GD and Freetype installed.

I followed your guidelines for adding the options to the fields. I sent several tests and they went through. I know Askimet is activated

Hi,

I’d like to add a link in the success message as follows:
Your message was sent successfully. Thanks. Click here to return to your previous page

How can I do this?

Patsy

Hi,

I’d like to add a link in the success message but the HTML doesn’t work. Let me know how I can do this?

Patsy

I can’t get this to work. For some reason it won’t let me submit messages. Anyone else have a problem with this? It set up nicely, but if it won’t actually forward messages than its kind of useless.

bug fix:
replace this line:
$html = ” . $value . ”;
with this line:
$html = ” . trim($value, ‘”‘) . ”;

… the problem occurs when you disable automatic and then try to have some default text that’s more than 1 line in a textfield.

Does anyone else see a difference between FF and IE when CF7 is Rendered on a page? I would like these browsers to render something similar – they don’t. AFAIK

Question… Any way to have a successful form direct to a thank you page? or Help in implementing Google conversion code?

Thx for your amazing plugin

I would like to allowed Zip files as attachment.

In wp-contact-form-7.php I changed the patern to:

// Default file-type restriction
if (” == $pattern)
$pattern = ‘jpg|jpeg|png|gif|pdf|doc|docx|ppt|pptx|odt|avi|ogg|m4a|mov|mp3|mp4|mpg|wav|wmv|zip|rar|7z’;

$pattern = trim($pattern, ‘|’);
$pattern = ‘(‘ . $pattern . ‘)’;
$pattern = ‘/\.’ . $pattern . ‘$/i’;
if (! preg_match($pattern, $file[‘name’])) {
$valid = false;
$reason[$name] = $this->message($contact_form, ‘upload_file_type_invalid’);
continue;
}
But it still reject all my zip file

What did I forgot to do?

Best regards

Can’t see the captcha code image? Ensure that you actually have the uploads folder created (by whatever name) which is registered in Dashboard, Settings, Miscellaneous. Create that folder if required with permissions 777.

That did it for me.

I can’t get really simple captcha to work. I have the graphic libraries installed, I have even tried to edit things in php which is a language I don’t know too well. I can’t fix this. I need help getting the image to show. My folders are writable, i have GD and the other library. What the heck is wrong here?

Whenever someone sent a message to me, I am not getting the right message to my mail. Just getting a message “[your message]” as text to my mail. could some one please let me know what’s the problem is?

Looking forward for your replies.

Thanks
Sankar

Here are the diffs for the necessary modification to allow the contact form 7 scripts to be relocated by other plugins (such as footer-js) or whatever. In other words, the proper way to embed JavaScript from a plugin… Especially since this script depends on JQuery!

Index: /contact-form-7/wp-contact-form-7.php
===================================================================
--- /plugins/contact-form-7/wp-contact-form-7.php (revision 117548)
+++ /plugins/contact-form-7/wp-contact-form-7.php (working copy)
@@ -693,7 +693,6 @@
};
//]]>

-<script type='text/javascript' src=''>

-<script type='text/javascript' src=''>
+
<?php
}

I keep getting the same error “email address seems invalid”.
No askimet is installed
I have removed and reinstalled the plugin several times.
I have tried several different email addresses.
Im lost please help.

Very useful plugin.

I would love to be able to customize the [contact-form] tag to include things that are related to the specific page the form is on. This way, the same form can be reused many times. Please add:

1. Post title
2. Page URL
3. Hidden fields

Thank you,
Gal

Hello — whenever I make the forms they are ALWAYS aligned to the center of the page. Text and form options too. Look at link below ….. I have upgraded to the newest version.

I have tried to use HTML tags to align, and also put the form in a TABLE and align it- but it never works

Can you help?

http://blog.confluencecoffee.com/music-booking/

While the submit button is pressed, “Your message was sent successfully. Thanks.” message is shown. But I dont get any mail in my mail account. Can anybody help me how to set up the mail account? or how to solve this problem?

[…] Contact Form 7 does just what it sounds like – facilitates the easy creation of contact forms. What Contact Form 7 does so well is its configuration panel, allowing for complex forms to be added rather than just a bland, simple form. Built-in captcha support is nice too, especially with all the spambots these days. […]

Hey,

Now my contact is working well. Just i made few changes in the code. that’s it. Any ways my thanks to iDeasilo for such a nice contact form providing us for free. Expecting same kind of nice projects in future.

Thanks
Sankar

Ok, great plugin, really, but I don’t understand why if I if use a checkbox or a radiobutton the submit button doen’t work, no way. I try everything… help me, please!

I am in the process of implementing a WordPress site. Is there an easy way(or any way) to add a “Print” button to the contact form?

Thanks, this is a great form. I am wondering if I can set it up so that a successful form directs the user to a thank you page?

Also, I don’t get the message that the form filling was successful, it just refreshes the page with an blank form and people don’t know if they were successful.

Love the form but only getting the message part of the form in my email all the rest of the info box dont show please help.

Ernie*

Small improvement:

I had a layout Problem if the Response div tag was empty so I altered your code to the following:

wp-contact-form-7.php [965]

$form .= ($content)?” . $content . ”:”;

but then I saw, that the AJAX stuff did not work any more, and I had to put it back.
But then I did something eaven better, I added the following into my css:

div.wpcf7-response-output{display:none;}
div.wpcf7-mail-sent-ok
,div.wpcf7-mail-sent-ng
,div.wpcf7-spam-blocked
,div.wpcf7-validation-errors{display:block;}

Pervect now!
THX for your Plugin.

Your plug-in is very helpful! There’s one problem I’ve encountered however, the coding that is inserted when the plug-in is activated doesn’t allow my site to be completely validated because there is a “/” at the end. Since I’m only using Traditional HTML, the sequence doesn’t work. Is there a way to remove these validation errors?

Hi, my name is Edelson Rodrigues, a Brazilian Guy. I come seek help. I’m tryng to use the Contact Form 7, but it doesn’t work. It seems to work, appears the message saying that the datas was sent, but the content doesn’t come to my email adress. May somebody help!? PLEASE.

Can you please tell me how can I move the Contact Form 7 link to be under Settings and not Tools in Admin area?

I tried changing “return ‘tools.php'” to “return ‘options-general.php'” in the function admin_menu_parent() but that didn’t move the link.

Thank you!

hi
I use this plugin a several time now, but since a couple of months the file upload have not been working anymore.

The system tells me there’s a yellow mistake (validation) and failed to upload file.

What can I do to make ik work again?
thanks!
greetings, ellen

Hello:

Is there any way to specify carbon copy (CC) address and/or blank carbon copy (BCC) address of the email to be sent by the form?

Contact Form 7 is being used very effectively to gather the comments from people right now. Some people are asking if they can get the copy of the contents they filled in the form using email acknowledgment. I think this is a reasonable request. CC or BCC will work in this case.

It is even great if this confirmation message is sent based on the choice of the user, like a check mark for “wanna copy of this to your email account” in the form.

Apologies in advance if this question was answered already.

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