Contact Form 7 Plugin for WordPress

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:

  1. Go to Plugins > Add New Plugin in your WordPress Admin.
  2. Search for "Contact Form 7".
  3. Click Install Now on the plugin by Takayuki Miyoshi.
  4. Once installed, click Activate.
  5. 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:

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:

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:

  1. Visit Google reCAPTCHA Admin Console at google.com/recaptcha/admin.
  2. Create a new site, choose reCAPTCHA v3 as the type.
  3. Add your website domain and click Submit.
  4. Copy the Site Key and Secret Key.
  5. In WordPress, go to Contact > Integration.
  6. Enter both keys and click Save Changes.
  7. 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:

Configuring WP Mail SMTP with Gmail

  1. Install and activate WP Mail SMTP.
  2. Go to WP Mail SMTP > Settings.
  3. Enter your From Email and From Name.
  4. Select Google / Gmail as the mailer.
  5. Create a Google App Password for the Gmail account you want to send from.
  6. Enter the Client ID and Client Secret from Google Cloud Console.
  7. Save and complete the OAuth authorization flow.
  8. 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:

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
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
CF7 Google Sheets Save submissions to Google Sheets Free

Troubleshooting Common Issues

Issue: Emails not arriving

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