Contact Form 7 (CF7) is one of the most widely used WordPress plugins in the world, with over 5 million active installations. It lets you create unlimited contact forms for free — from simple inquiry forms to multi-field booking and registration forms. This guide walks you through installation, configuration, email setup, spam protection, and troubleshooting common issues.
Why Contact Form 7? 100% free, lightweight, highly flexible, AJAX-powered, rich ecosystem of add-ons, and a huge community for support.
What Is Contact Form 7 and Why Is It Popular?
Contact Form 7 is an open-source WordPress form plugin developed by Takayuki Miyoshi since 2007. Because it is completely free with no locked features, it became the default choice for millions of website owners globally. The key concept behind CF7 is "form tags" — shortcode-like tokens that generate HTML form inputs automatically, letting you embed a form anywhere on your site with a single line of shortcode.
Its flexibility makes it a favorite among developers. You can extend CF7 almost infinitely using WordPress hooks and filters, or install third-party add-ons such as CF7 Honeypot (spam protection), Conditional Fields CF7 (show/hide fields based on user selection), CF7 to Zapier (webhook integration), multi-step form extensions, and many more.
Out of the box, CF7 supports AJAX form submission so the page does not reload on submit, file uploads with type and size restrictions, reCAPTCHA v3 for spam prevention, and multiple forms on the same page — each independently configured.
Installing Contact Form 7
There are two ways to install CF7. The easiest method is directly from your WordPress dashboard:
- Go to Plugins > Add New Plugin in your WordPress Admin.
- Search for "Contact Form 7".
- Click Install Now on the plugin by Takayuki Miyoshi.
- Once installed, click Activate.
- A new Contact menu will appear in the left sidebar.
Alternatively, download the ZIP file from WordPress.org, then go to Plugins > Add New > Upload Plugin and upload the ZIP file. This method is useful if your hosting environment restricts direct plugin installation from the dashboard.
Compatibility note: Contact Form 7 requires WordPress 6.0 or higher and PHP 7.4 or higher. Always keep both WordPress core and CF7 updated to the latest version for security and compatibility.
Creating a Form and Understanding Form Tags
After activation, CF7 creates a sample form automatically. You can edit it or create a new form at Contact > Contact Forms > Add New.
Form tags are the building blocks of every CF7 form. Each tag generates an HTML form element. The most important tags to know:
[text your-name]— single-line text input[email your-email]— email input with format validation[tel your-phone]— telephone number input[textarea your-message]— multi-line text area[select your-subject]— dropdown select list[checkbox your-checkbox]— checkbox group for multiple selections[radio your-radio]— radio buttons for single selection[file your-file]— file upload input[date your-date]— date picker[submit "Send Message"]— submit button[recaptcha]— Google reCAPTCHA (requires setup first)
Sample Basic Contact Form Code
<label> Your Name (required)
[text* your-name] </label>
<label> Your Email (required)
[email* your-email] </label>
<label> Subject
[text your-subject] </label>
<label> Your Message (required)
[textarea* your-message] </label>
[submit "Send Message"]
The asterisk * after the tag name marks that field as required. If a user leaves it blank, CF7 will display a validation error automatically without a page reload.
Configuring the Mail Tab
After building your form, the most critical step is configuring the Mail tab. This determines who receives an email when someone submits the form, what subject line is used, and what content the email contains.
Click the Mail tab in the form editor. Key fields to fill in:
- To: the recipient email address, e.g.
[email protected]. Multiple addresses can be separated by commas. - From: the sender address. Always use an email from your own domain, e.g.
[email protected]. - Subject: the email subject line. You can embed user data using mail tags, e.g.
[your-subject]. - Additional Headers: add
Reply-To: [your-email]so replies go directly to the form submitter. - Message Body: the email content using mail tags like
[your-name],[your-email],[your-message].
Example Message Body
From: [your-name] <[your-email]>
Subject: [your-subject]
Message:
[your-message]
---
Sent from contact form at https://yourwebsite.com/contact/
IP Address: [_remote_ip]
Date: [_date] at [_time]
Important: Never put the submitter's email ([your-email]) in the "From" field directly. This will cause emails to be rejected by DMARC policies. Use your own domain email in "From" and set Reply-To to [your-email] instead.
Mail 2 — Auto-Reply to the Submitter
CF7 includes an optional Mail 2 feature that sends an automatic confirmation email back to the person who filled out the form. Enable it by checking Use Mail 2 and configuring it like the primary mail — but set the "To" field to [your-email] so the reply goes to the submitter. This gives a professional acknowledgement such as "Thank you for contacting us. We will respond within 24 hours."
Setting Up reCAPTCHA v3 for Spam Prevention
reCAPTCHA v3 analyzes user behavior in the background without any user interaction — no "I am not a robot" checkbox needed. To set it up:
- Visit Google reCAPTCHA Admin Console at
google.com/recaptcha/admin. - Create a new site, choose reCAPTCHA v3 as the type.
- Add your website domain and click Submit.
- Copy the Site Key and Secret Key.
- In WordPress, go to Contact > Integration.
- Enter both keys and click Save Changes.
- Add
[recaptcha]to your form before the submit button.
Pro tip: Combine reCAPTCHA v3 with the "Honeypot for Contact Form 7" plugin. The honeypot adds a hidden field that bots fill in, providing a second layer of spam detection without affecting legitimate users.
Fixing Email Delivery with SMTP
The most common CF7 complaint is emails not arriving. The root cause is WordPress using PHP mail() by default, which many hosting providers block or spam filters reject. The solution is to install an SMTP plugin:
- WP Mail SMTP — most popular; supports Gmail, Outlook, SendGrid, Mailgun, Amazon SES, and generic SMTP.
- FluentSMTP — fully featured free option with built-in email logging and support for multiple providers.
- Easy WP SMTP — simple and beginner-friendly for basic SMTP setups.
Configuring WP Mail SMTP with Gmail
- Install and activate WP Mail SMTP.
- Go to WP Mail SMTP > Settings.
- Enter your From Email and From Name.
- Select Google / Gmail as the mailer.
- Create a Google App Password for the Gmail account you want to send from.
- Enter the Client ID and Client Secret from Google Cloud Console.
- Save and complete the OAuth authorization flow.
- Test delivery via WP Mail SMTP > Email Test.
AsiaGB Hosting tip: You can use your hosting SMTP directly. Set the host to mail.yourdomain.com, port 587 (TLS) or 465 (SSL), and enter the username and password for an email account created in DirectAdmin.
Validation and Custom Error Messages
CF7 includes built-in validation for all required fields and email format. You can customize all error and success messages under the Messages tab in the form editor:
- Sent successfully: e.g. "Thank you for your message. We'll be in touch soon!"
- Failed to send: e.g. "There was an error. Please try again."
- Required field is empty: e.g. "Please fill in this field."
- Invalid email format: e.g. "Please enter a valid email address."
- File too large: e.g. "The file you uploaded is too large."
Styling Your Contact Form
CF7 inherits the styles from your active theme. You can customize the appearance by adding CSS to Appearance > Customize > Additional CSS or in your child theme's style.css:
/* Contact Form 7 custom styles */
.wpcf7 input[type="text"],
.wpcf7 input[type="email"],
.wpcf7 textarea {
width: 100%;
padding: 12px 16px;
border: 1px solid #ddd;
border-radius: 6px;
font-size: 15px;
margin-bottom: 12px;
}
.wpcf7 input[type="submit"] {
background: #059669;
color: #fff;
border: none;
padding: 12px 32px;
border-radius: 5px;
font-size: 15px;
cursor: pointer;
}
.wpcf7 input[type="submit"]:hover {
background: #047857;
}
File Upload Configuration
CF7 supports file attachments using the [file] tag. You can restrict file types and size:
[file your-file limit:5mb filetypes:jpg|png|pdf]
This accepts only JPG, PNG, and PDF files up to 5MB. When the form is submitted successfully, the file is attached to the notification email. Always restrict file types to prevent security risks from arbitrary file uploads.
Popular Add-ons for Contact Form 7
| Add-on | Function | Price |
|---|---|---|
| Honeypot for CF7 | Additional bot spam protection | Free |
| CF7 to Zapier | Connect to Zapier / webhooks | Paid |
| Conditional Fields CF7 | Show/hide fields based on conditions | Free |
| CF7 Multi-Step Forms | Multi-step form wizard | Free |
| Stripe Payments CF7 | Accept payments via Stripe | Paid |
| CF7 Google Sheets | Save submissions to Google Sheets | Free |
Troubleshooting Common Issues
Issue: Emails not arriving
- PHP mail() blocked: Install WP Mail SMTP or FluentSMTP and send through a real SMTP server.
- Emails going to spam: Check SPF, DKIM, and DMARC DNS records for your domain. Use a domain email in the From field.
- Wrong From email: Use an email from your own domain (not a Gmail address in the From field).
Issue: "Spam detected" error
If Akismet is active, it may be blocking form submissions flagged as spam. Temporarily disable Akismet to test. If needed, configure the CF7–Akismet integration within CF7 settings to fine-tune the spam scoring threshold.
Issue: Page reloads on submit (no AJAX)
This usually means a JavaScript conflict. Open your browser's developer console and check for JS errors. Try disabling other plugins one by one to identify the conflict. Also confirm that jQuery is loading correctly and is not being dequeued by another plugin.
Issue: CF7 scripts load on every page
By default CF7 loads its CSS and JS on all pages. To restrict it to pages with forms, add to your child theme's functions.php:
add_filter('wpcf7_load_js', '__return_false');
add_filter('wpcf7_load_css', '__return_false');
Then manually enqueue on specific pages using wpcf7_enqueue_scripts() and wpcf7_enqueue_styles().
Start with AsiaGB WordPress Hosting
Fast WordPress Hosting with DirectAdmin — ready to run your best plugins right away.
View Hosting Plans