WordPress Contact Form Not Sending Email? Fix It
In this article
Your WordPress contact form stops sending emails because the server's PHP mail() function is blocked, misconfigured, or your messages are landing in spam. The fix is usually switching to an SMTP plugin or a transactional email service. Below, we break down why this happens and exactly how to restore delivery.
How WordPress Contact Forms Send Email
Most contact form plugins (Contact Form 7, WPForms, Gravity Forms) rely on WordPress's built-in wp_mail() function. That function, in turn, uses PHP's mail() by default. The server sends the email directly from your hosting account, without any authentication. This is the root of most delivery problems.
Direct sending means the receiving server (Gmail, Outlook, Yahoo) sees an unauthenticated message from an unknown IP. Spam filters are aggressive with such mail. Even if the email is sent, it often lands in the recipient's spam folder or is silently dropped.
Why Your Emails Stop Arriving
Several common triggers cause the sudden failure:
- Hosting blocks
mail(): Many shared hosts disable the PHP mail function to prevent spam. They require you to use SMTP instead. - Spam filtering: Your messages are being sent but are marked as spam by the recipient's provider.
- Server IP blacklisted: If a neighbor on your shared server sent spam, the entire IP range can be blacklisted, causing your mail to be rejected.
- Plugin or theme conflict: A recent update or a new plugin can interfere with the mail function.
- Incorrect SMTP settings: If you already use SMTP, the credentials or server details may be outdated.
- Form not actually submitting: Sometimes the form fails silently due to a JavaScript error or a missing required field.
How to Diagnose the Problem
Before changing anything, you need to know whether the email is being sent at all. Follow these steps:
- Check spam folders: Look in the spam folder of the email address you used in the form. If you see the message there, the problem is deliverability, not sending.
- Install a mail logging plugin: Plugins like WP Mail Logging or WP Mail SMTP's built-in log will show you whether the email was handed off to the server successfully.
- Test with a simple contact form: Temporarily switch to a default theme (like Twenty Twenty-Four) and disable all plugins except your contact form plugin. If the email works, re-enable plugins one by one to find the culprit.
- Check your server error logs: Your hosting control panel (cPanel, Plesk) has an error log. Look for lines mentioning
mail()or SMTP failures.
Fixing It: The SMTP Solution
The most reliable fix is to configure your WordPress site to send email through an SMTP server. This is the same method used by professional email clients. It authenticates your domain and dramatically improves deliverability.
Here's how to do it:
- Install an SMTP plugin: WP Mail SMTP, Easy WP SMTP, or Post SMTP are popular choices. WP Mail SMTP is the most widely used.
- Enter your SMTP settings: You'll need the SMTP host (e.g., smtp.gmail.com), port (587 for TLS, 465 for SSL), and your email account credentials.
- Use your email provider's SMTP: If you use Gmail, you'll need an App Password. If you use a business email (e.g., your domain with cPanel), the SMTP details are in your hosting account.
- Send a test email: Most SMTP plugins have a test button. Use it to verify the connection works.
Alternative: Transactional Email Services
If you send a high volume of emails or want the highest possible deliverability, consider a transactional email service. These are built for sending automated emails reliably. Popular options include SendGrid, Mailgun, and Amazon SES. They work by giving you an SMTP endpoint or an API key that you plug into your SMTP plugin. Most have free tiers for low volume, which is sufficient for most contact forms.
Common Mistakes to Avoid
- Using the wrong port: Port 25 is often blocked by ISPs. Use 587 (TLS) or 465 (SSL).
- Using your regular Gmail password: With Gmail, you must create an App Password. Your normal password won't work.
- Forgetting to update DNS records: If you use a custom domain email, you may need to add SPF and DKIM records to prove you own the domain. Your email provider will give you these records.
- Not checking the log: After making changes, always send a test and check the log to confirm it was sent.
What If SMTP Isn't the Issue?
Sometimes the problem is not the sending method. Here are other fixes to try:
- Update your plugins and themes: Outdated code can break the mail function.
- Check for form validation errors: Use your browser's developer console (F12) to see if there are JavaScript errors on the page.
- Increase PHP memory limit: Some hosts set it too low, causing the mail function to fail silently. You can temporarily increase it by adding
define('WP_MEMORY_LIMIT', '256M');to yourwp-config.phpfile. - Contact your host: If you've tried everything, ask your hosting provider if they block
mail()and if they have an SMTP server you can use.
Frequently Asked Questions
Why are my WordPress emails going to spam even after using SMTP?
SMTP improves deliverability but doesn't guarantee it. Common reasons include: your domain's SPF/DKIM records are missing, the sender email address is not on the same domain as your site, or the email content contains spammy words. Check your email provider's documentation for the correct DNS records.
Can I use my Gmail account to send WordPress emails?
Yes, you can. You'll need to enable 2-Step Verification and create an App Password. Then use smtp.gmail.com with port 587 and your full Gmail address as the username. Note that Gmail limits sending to 500 emails per day for free accounts.
Is it safe to use an SMTP plugin?
Yes, reputable SMTP plugins are safe. They handle your credentials securely and are widely used. Just make sure you download them from the official WordPress plugin repository or a trusted source.
My form says 'sent' but I never receive the email. What's wrong?
This usually means the email was handed off to the server but was rejected later. Check your spam folder, look at the mail log for an error message, and verify that the recipient email address is correct. Also, check if your hosting provider has a daily sending limit.
Do I need a transactional email service if my site is small?
Not necessarily. For a small site with low traffic, a correctly configured SMTP plugin using your hosting or a free Gmail account is usually enough. Transactional services become necessary when you send hundreds of emails per day or need advanced analytics.
What is the best SMTP plugin for WordPress?
WP Mail SMTP is the most popular and has a free version that supports all major providers. Other good options include Easy WP SMTP and Post SMTP. The best one is the one that works with your email provider and is actively maintained.