A contact form gives visitors an easy way to reach you without exposing your email address to spam bots. How you add one depends on whether your site runs on WordPress or is a plain HTML website, and the setup only takes a few minutes either way.
Adding a Contact Form in WordPress
The simplest way to add a form in WordPress is with a form plugin. Free plugins such as Contact Form 7 or WPForms handle the form builder, spam protection, and email delivery for you.
- Log in to your WordPress admin dashboard.
- Go to Plugins, then Add New Plugin.
- Search for a form plugin (for example, Contact Form 7 or WPForms), then click Install Now followed by Activate.
- Open the plugin's menu item that appears in your dashboard sidebar and create a new form. Most plugins come with a ready-made contact form template you can use as-is.
- Copy the shortcode the plugin gives you (it looks something like [contact-form-7]) and paste it into the page or post where you want the form to appear, using the block or shortcode editor.
- Set the form's send to email address in the plugin's mail settings, then publish the page and submit a test entry to confirm it arrives.
Adding a Contact Form to a Non-WordPress (HTML) Website
If your site is built with plain HTML, you have two practical options.
Option 1: A third-party form service
Form services let you build a form on their site and paste a small snippet of code into your HTML page. They handle spam filtering and email delivery without needing any server-side code from you, and most offer a free plan for low volumes.
Option 2: A PHP mail script
If your hosting plan supports PHP, you can write a simple PHP script that takes the form fields and emails them to you using PHP's mail function. This gives you full control over the form's design but requires some basic PHP knowledge, and you should add a spam check (such as a honeypot field or CAPTCHA) since a plain PHP form is an easy spam target.
Whichever option you choose, never hard-code a password or sensitive credential into a script that's stored in a publicly accessible folder on your website.
If Your Contact Form Emails Aren't Arriving
This is the most common contact form problem, and it's almost always one of these causes:
- Check your spam or junk folder first. Emails sent from a script on your server can sometimes be flagged as spam by the receiving mailbox.
- Confirm the send-to address is correct and that the mailbox isn't full.
- Make sure your domain's email authentication is set up correctly. Missing SPF or DKIM records are a common reason automated form emails get marked as spam or rejected outright.
- If you're using a PHP mail script, try switching it to send through your hosting account's SMTP settings instead of the basic mail function, since many receiving mail servers trust authenticated SMTP mail more.
For a closer look at fixing authentication issues, see How to Set Up SPF and DKIM Records to Stop Your Emails Going to Spam.