Skip to Content

Contact Forms

Summary

This tutorial covers adding a contact form to your website using Contact Form 7, including whether you actually need one in the first place. It walks through building the form fields, wiring up the email delivery, blocking spam with an invisible CAPTCHA from Cloudflare, and sending emails reliably using a dedicated SMTP service instead of your own hosting.

Video

Introduction

Contact forms aren’t for everyone. It’s not particularly difficult for people to find a personal email address online, and services like Gmail already do a great job filtering spam — so if you’re a freelancer or an individual, it’s often simpler to just put your email address on your contact page instead. Setting up a proper contact form means signing up for two separate services, and it’s worth testing the form periodically too, since it won’t tell you on its own if it stops working. It’s worth genuinely considering whether you need a contact form at all before setting one up.

Adding the Contact Form

If you do want one, the most-used plugin for the job is Contact Form 7 — install and activate it like any other plugin, and it adds a Contact Forms section to your WordPress menu. Opening a form lets you adjust its fields: to add something like a phone number field, copy one of the existing field labels and replace the placeholder inside the brackets. There are plenty of options here, and the easiest way to work through them is either the plugin’s documentation or simply asking an AI, which can generate the exact code you need. A star symbol next to a field marks it as required — without it filled in, the form won’t submit.

Mail Settings & Adding the Shortcode

The Mail tab controls where submissions get sent as email, and it’s important — if you’ve added new fields to the form itself, you also need to add them here, or they simply won’t appear in the email you receive.

Once that’s set up, copy the form’s shortcode, open the Gutenberg editor for the page you want the form on, add a Shortcode block, and paste it in. Unfortunately, that alone isn’t quite enough to have a properly working form.

Preventing Spam with a CAPTCHA

Left as-is, your inbox will quickly get swamped with spam submissions, and emails sent this way go out through your own hosting, which tends to be unreliable. The spam problem needs a CAPTCHA — and there are now a few options for an invisible one; this tutorial uses Cloudflare Turnstile.

After creating a free Cloudflare.com account, go to Application Security, click Turnstile, and add a widget manually. The widget name doesn’t matter, but add your actual domain as the hostname, and set the widget mode to Invisible — whether to reference their policy in your own privacy policy, as Cloudflare asks, is up to you. Clicking Create gives you a site key and a secret key, which you paste into WordPress under Contact → Integration, in the Turnstile integration settings. That handles the spam.

Sending Emails Reliably

For actually sending the emails, it’s more reliable to use a dedicated email service rather than your own hosting. This tutorial uses Brevo, which offers around 300 free emails a month. After creating an account at brevo.com, go to Settings → SMTP & API → API Keys, and generate a new key — the name doesn’t matter, and it’s fine to set the expiry to never.

Pasting that key directly into Contact Form 7’s integrations unfortunately doesn’t seem to work reliably. Instead, install and activate the WP Mail SMTP plugin, choose Brevo as the mailer in its settings, paste in your API key, and add your domain. Finally, go back to your contact form and send a test submission to confirm everything’s working.

Conclusion

That’s it for setting up a contact form. Good luck, and if you run into any issues, don’t hesitate to contact me.