It’s always good to routinely check to see if the contact form on your website is sending or not. I usually get people telling me, “I can’t send emails in WordPress!!!!” But I’m the web designer, certainly, I am not having problems sending emails? Right? Well, I tried. And it wasn’t! Not on the first try, anyway. I eventually fixed the issue, but it took some debugging and bug tracking to get the job done!
Can’t Send Emails with WPForms in WordPress
For starters, I had to see what problems I had and keep a keen eye on what changed.
Upon submission, the contact form would return with a generic error message saying to contact me :facepalm:
The page would refresh and add a query string to the URL: ?ignorenitro=
Clicking the send button again would send the form through.
But that is a problem, because if people run into an error the first time, they may assume the form does not work and leave.
That query string was news to me, but I did recognize that the text included the distinct word nitro, as in nitropack. I put that under my hat as in I might need to investigate later to see if nitropack was the issue.
Doublecheck your Work to See if you can Send Emails
Having a problem in one browser doesn’t mean it happens in all browsers. Since I started in Chrome, I decided to try Chrome in incognito mode. Incognito mode is a browser mode that basically does not save any cookies and makes it look like you are on a separate computer. So after testing the contact form in that mode, I ran into the same problem.
I next tested the form in FireFox. Running through the same process, I ran into exactly the same problem in that browser, too.
Great. No, really, great! That means it’s not an isolated incident and once I find the fix, it fixes it for everyone.
Laying a Trap: Logging Email Errors
Now that I saw there was an issue, I had to lay a trap. I wanted to see if this was triggering any errors that I can easily track down. I checked the developer console by pressing F-12 and checked for errors. None!
Next, I checked to see if WPForms supports error logs. It does!
I enabled logging and then tested the form again. I got the same error, as expected, and then I checked the logs to see what, if anything, got generated.
WPForms showed that the cause for the error was that the email triggered a SPAM filter.
Thinking about security and what could see my contact form as SPAM, I thought about a security plugin that I use, WordFence.
I disabled WordFence assuming that if it was not monitoring my emails, then it could not be seen as SPAM. Well, I was wrong! Even with WordFence disabled, the form was still not sending on the first try.
NitroPack Conflict Preventing Emails
If the developer console isn’t showing any errors, and WordFence isn’t causing an issue, then what is?! I decided to look into that ignorenitro query token from earlier. Why was it being generated, and how can I prevent it? After all, NitroPack is an optimizing plugin, not a security plugin…
I went to NitroPack to see if there was a section where I can tell it not to optimize my contact page. If this was successful, then the ignorenitro keyword would not appear and hopefully, the contact form would go through on the first try!
I excluded my URL from NitroPack’s claws and re-tested the contact form in Chrome. Success! I tried the form in Chrome but in incognito mode… Success! 2 for 2. But not out of the woods yet. I went to FireFox and tried the contact form… SUCCESS!
So as it turns out, a plugin that I used for one purpose actually interfered in my contact form, causing it to look like SPAM and to not send on the first attempt. This is an extremely vital fix, as you can imagine, as contact forms are what people use to connect to service providers. And if your contact form is not working as it should, you could be losing customers!
I can’t send emails! I don’t have WPForms
This was just one case that I solved, but there can be so many other reasons you can’t send emails! If you have an issue with your contact form and you can’t figure out how to fix it, drop me a line and I can fix your email problems.