Configuring Contact Form 7

askjeff80x80This post is part of an ongoing series called Ask Jeff. Since writing this article, I have used GravityForms to take care of my contact form needs. Not only is it easy to configure but it’s the plugin choice of many when it comes to contact forms. You can even use it to create a post submission area on your site. Take a look at it and give it a try. This is where I’ll take a question someone within the WPTavern or WordPress community gives me and provide my thoughts/answer to. This weeks question was submitted by Paula.

I installed Contact Form 7. Copied that line of code onto my page. The contact form shows up but nothing comes in to my email box. What am I doing wrong?

Contact Form 7 is one of my favorite plugins because it’s one of those configure and forget type plugins. In this case however, something has gone awry. For starters, I’ll walk you through how to configure this plugin.

Once Contact Form 7 is installed, you can access the plugins settings by browsing to TOOLS – Contact Form 7. Here, you should see a contact form already set in motion at the top of the page. This top box contains the code you’ll need to copy and paste into a page, post, or text widget. It should look similar to this.

contactform1

But before you can use that form, we’ll need to configure the necessary fields. This is the Form area. On the left hand side is a text area containing the HTML as well as the shotcodes for your contact form. On the right, you should see a Generate Tag drop down button. When you click this, you have a bunch of options to choose from regarding fields. For instance, you can add a drop-down menu, radio buttons, checkboxes, CAPTCHA, file upload, etc. Here is my contact form already configured on the left with a look at the tag generator on the right.

forminaction

Once we have the form put together, we’ll need to configure the Mail options so when someone submits a form, it will be sent to our inbox. The TO: field at the top is the email address where submitted forms will be sent to. The from box is simply the form fields that were filled out and the subject area provides you with the opportunity to create a custom message header which I have done in the following screenshot so that I can create a custom email filter for Thunderbird. Also, this lets me know that a message was sent from the WPTavern website.

cf7mailsettings

Last but not least, you can configure the actual messages end users will see when they perform an action. For example, if the message fails to be sent, they will see the message corresponding to that event.

Once you’re finished with that, click the save button and you’re ready to create a new page where you can add your contact form shortcode via the HTML tab in the post editor which will display your contact form on the page.

In the end, if emails are not being sent to your inbox through your contact form, double check your mail settings to make sure you didn’t put in a typo with your email address. Secondly, make sure your using spam filters to allow emails to be accepted from your domain. Last but not least, it could be the Subject Line that you configured which is telling your email software that the message is spam. Configure your software to allow for that subject line if need be.

Submit Your Question:

If you have a question regarding any aspect of WordPress you would like me to answer or at least, hear my take on, you can either contact me using the following contact form with your question or you can follow WPTavern on Twitter and send me an @reply with your question. If the WPTavern account is following you, simply send me a Direct Message with your question. Don’t expect expert opinions or answers as I’m not an expert

Something Better:

Since writing this article, I’ve ditched using Contact Form 7 in favor of a commercial plugin called Gravity Forms which is awesome and easy to configure. Take a look at it and give it a spin.

42 Comments


  1. Yeah – this plugin is usually one of my faves. Others out there are somewhat overkill IMHO. One of the other nince things that Contact Form 7 supports is decent styling of elements via CSS classes.

    Report


  2. @Kel – Yeah, that is true. I didn’t mention this in the post but surprisingly, I’ve had very little spam arrive in my inbox through my sites contact form. Maybe the simple captcha configuration I use is enough :)

    Report


  3. Hi,
    I am trying to set up Contact Form 7 and although I get the message, the email from the sender does not appear so if I would like to contact that person again, I have no way of doing so. My form can be seen here:

    http://notilocas.com/contact_us

    I do appreciate any help you could give me. Thanks!

    Julio Foppoli
    info@notilocas.com

    Report


  4. @Julio – Hmm, well if your form is asking for the end users email address, it should definitely be part of the email that is sent to your inbox. When you view the email message that is sent to you via the contact form, what does it say in terms of the “Sent by” address?

    Report


  5. Thanks for your efforts here Jeff.

    CF7 is great, BUT, it displays differently on FF and on IE. That’s not a big surprise, but how do we deal with this? And who knows about Opera and the rest.

    I cannot get a decent compromise formatting the textboxes ‘sender’s email’, ‘subject’ and ‘message body’. Any hints on how to do this are very welcome.

    Thanks. And in any mention of CSS please note extreme clarity is required to get past my lack of experience filter.

    Report


  6. How exactly can I add a checkbox that is already checked when the contact form loads and adds the email address to a email newsletter database I created? Can anyone help me out? Been trying to figure this out all day!

    Report


  7. What if you want to use contact form to send email to more than one person? such as a real estate website with multiple agents. how do you make sure that the correct agent is getting the e-mail, say regarding his or her property listing?

    Thanks!

    Report


  8. Any way to get HTML (links) to show in the success messages?

    Report


  9. Hey Jeff,

    First of all I a novice with this so my question maybe a bit silly….pls bear with me :)
    I just added contact form 7 to my site and I would like to change the ‘click here to send’ into a button. How can I make that change? Would you be able to assist me with that?
    BTW just found your site and am enjoying and learning a lot.
    Regards,
    Heguiberto

    Report


  10. Is there a way of displaying the error / thankyou messages centrally both vertically and horizontally – currently if a user has a validation error the message is displayed right at the bottom of the page – the user might not see it!

    Report


  11. Hello I had “page not found”(Error 404) error on form submission.

    I rectified it by adding

    line in footer.php of my theme.

    Now it is working fine.

    Thanks Jeff

    Report


  12. Jeff,
    I have contact form 7 up and running. When I do a test, it send the email and I receive it but it’s from noreply@myurl. So this prevents me from even reply to the person trying to contact me. Any idea why this is?

    Report


  13. Helllo there,

    I have the contact form in which i have a dropdown menu for the states. I was able to make my other fields mandatory, but I was not able to make the state field mandatory..can anyone please tell me where to put the ‘*” mark in this code, to make the dropdown menu of states mandatory…please help thank you in advance…

    State
    [select menu-695 “Alabama ” “Alaska ” “Arkansas ” “Arizona ” “California ” “Colorado ” “Conneticut ” “Delaware ” “Florida ” “Georgia ” “Idaho ” “Illinois ” .. ]

    Report


  14. Thanks for this. It helped. Although it seems that now to access the settings, you have to go through the Plug-ins settings not the Tools. Your coding example for the Captcha was really helpful.

    Report


  15. I thought I had the validation message on my site changed, but it’s not. I can’t figure out where to change it. Any ideas?w

    Report


  16. I love Contact Form 7 and am actually using it to run a survey from my page, which has been very helpful!

    I know you mentioned in the article that you are not the author, however I am pretty sure my question is a super simple one and can probably be answered by someone here.

    I have configured the checkboxes into yes or no questions. However, when people fill out the contact form, their yes or no answer is not showing up. In the message body section of the form, my checkbox tag looks like this: [Are-you-a-high-school-or-college-student “Yes” “No”]

    However, it comes through in the e-mail looking like this: [Are-you-a-high-school-or-college-student “Yes” “No”] — instead of as a simple yes or no answer, which would correlate with the box they checked.

    Any idea what I might be overlooking?

    Report


  17. @Brooke

    I had this problem too a few weeks ago and i finally solved it.

    in your contact form your Yes No box should look like this:

    Are you a high school or college student? [radio radio-123 "Yes" "No"]

    your email section should be

    High School or College: [radio-123]

    I hope this helps

    – Steve

    Report


  18. Jeff,
    I have contact form 7 up and running. When I do a test, it send the email and I receive it but it’s from noreply@myurl. So this prevents me from even reply to the person trying to contact me. Any idea why this is?

    I am having the same problems =( Any idea what is causing this?

    Report


  19. @Kel – How do I link my CSS to the form? I mean What parts of the code generated by the form 7 do I use as the id or class in my css?

    Report


  20. Hello Jeff, and everyone else

    I wonder if i can send the contact form from a post-page, to the email address from the settings and send a copy to an email adress that loads from a custom field in the post.

    I’ll try to explain it simple:

    [POST’s PAGE] loads custom field with email –> contact form 7 –> CONTACT DATA –> mailto (emailadress1 + customfield_emailaddress)

    any idea appreciated!

    Report


  21. You should write an article on how to customize Contact Form 7 with CSS.

    Report


  22. I too love Contact Form 7. I wish it had better captcha integration but I just use the 1+1=? question. In any case it sure beats having to hand code forms.

    One thing I like to do with this plugin is to use it for “refer website to a friend” button. I configure it so it sends email to the friend and it send me the info on who sent the referral to whom and what they said. This way is the referral calls me I already know some background information based on who shared my site with them.

    Report


  23. I am trying to set up a form that includes a set of radio buttons. I want to have one of the buttons already selected when the page loads. Is there any way to accomplish this? It would be much easier than having to force people to choose a radio button every time…

    Report


  24. @Mike – Lots of people includng mself have this issue. Closest thing Ive seen in forums is simplepress forums causes a conflict, but Its something more. Im looking for halp 2!

    Report


  25. I did not see an answer to jfisher’s question, which is also my question:
    Any way to get HTML (links) to show in the success messages?

    Report


  26. @Jocelyn Mozak -could you tell me how you set this up, or send me a link that shows how to do it? This is exactly what I want to do.

    Report


  27. Make sure you allow comments to be “on” on your page or Contact Form 7 will not work properly. If you don’t allow comments it WONT Work…

    Report


  28. Thank you so much by saying that you need to include a form element in the message. I had “MyWebsite.com Contact” as my e-mail subject and I was just attacked by spam.

    Report


  29. @Adam – I’m having a similar problem except I get the email correctly. However, when I click on reply (using Gmail), the “To:” field gets filled with noreply@sitedomain.com. Is there a way to make it so the email of the sender gets filled in that field instead of the noreply?

    Report


  30. @beachbum

    Thanks for your reply. I read the description of that plugin and it looks like it allows you to set the “From” line for emails which actually isn’t a problem for me. The emails arrive ok with the “From” field filled out correctly. However, when I click reply, the “To” field gets changed to noreply@sitedomain.com. I’m wondering if that plugin will take care of the problem for me even though I didn’t read any mention of it in the description.

    Report


  31. I have loaded Contact Form 7 on a number of sites. All used to work well.

    Recently, ALL of the forms stopped working on all sites. When the “Send” button is clicked, the little arrows revolve, but nothing happens. No mail is sent and the process doesn’t end.

    From other forums, this looks like a common problem, but there is no solution being proposed.

    Any ideas why this should be happening?

    Report


  32. sorry if this is too simple a question, @sbatuev, but in what css file is the new button style to be put? I’ve tried:

    /wp-content/themse/arras-theme/css/styles/default.css
    /wp-content/themse/arras-theme/css/mycss.css (the stylesheet particular to the site)

    So far, no dice. & just to be thorough, I have referenced the new style in the settings page for the form to:

    [submit class:SignUpForEmailSubmitButton ” “]

    – O8

    Report


  33. Thanks for the help guys, “send-from” plugin works perfect for my site. also, a big thanks for this forum no need to ask question. my little reading allows me to solve my huge problem..

    goodluck everybody.

    Report


  34. Im using contact form 7 with email drop down option as
    [checkbox* departments
    “Department name1|department1@test.com”
    “Department name2|department2@test.com”
    “Department Name3|department3@test.com”]
    and generating an auto response from it as :”Your email has been received to the [departments] department.”
    I need department name to appear instead of email address, Like Department name2 instead of department2@test.com.
    please help!.

    Report


  35. Hi – Not sure if anyone can help me but I have the contact form all ready to go and I am getting the emails just fine. I have a file upload on my form and this is what I have.

    This is what I currently have:
    Form: [file* yourfile]
    Mail: [yourfile]
    Body: [yourfile]

    Also I can get into the temp folder and I see the file there….so it’s just not getting sent to my email (but I am receiving the email just without the file attached.) I had it working earlier – so I know it does work but I am not sure what changed…hmmm. I have also checked out the plug-in site help but I don’t know what I am doing wrong and their comments are close. Hoping for an answer! Thanks for any help!

    Report


  36. This plugin is very hokey! Works on some accounts and not others. It’s sending my client nothing. So he loses his emails from customers. So we will have to code out a form from scratch because at least we know it will work. I am sure that there are other form generators out there for wordpress but I don’t feel like searching, installing, and testing plugins. Just easier to code it from scratch since 99.9% of all plugin developers don’t provide a demo. WTF?

    Report

Comments are closed.