Recently, the email services on one of my WordPress sites hosted on a specific server stopped working. When I investigated other WordPress sites, I noted that they had also stopped sending emails. This type of situation can become quite frustrating, so I wrote down my steps to find a solution. This should take you through just about every possible place that could be causing an issue.
As any person would do when you are unaware where to start in debugging, I googled this problem. It search was filled with ways to fix it through a plugin. Now, don’t get me wrong, there are many great plugins out there, but the email worked at one time without the use of a plugin. I decided to dig a bit deeper.
When Google gave little assistance in a true fix for the email not working, I rolled all the way back to the beginning by:
deactivating all plugins in one of my sites.
I tested my email by changing my Settings > General > Email
The Test Failed
When this method did not work, I realized there was an issue that reached beyond WordPress itself. I would have to check the Server.
Third Investigating the Server
I personally use Ubuntu 18.04 for all of my server. If you do not use Ubuntu this part might be slightly different for you.
I first checked var/log/mail.log. This is where all email errors will be saved.
I cleared it and re-uploaded it to my server to ensure I was getting a fresh error.
Then tested my email by changing my Settings > General > Email.
After that I grabbed the mail.log again, and was presented this error:
Cannot write ./dfx912K1nA123440 (bfcommit, uid=0, gid=130): No such file or directory
This error made it seem like it was a problem with “sendmail itself.
Fourth Investigating Sendmail
I started with a simple status check:
sudo service sendmail status
When I checked my status, I noticed that the same error was present in the status variables.
I did a restart:
sudo service sendmail restart
I rechecked the status and the errors were still there. What is going on?
As I was unsure what could be happening, I decided to reinstall sendmail. First Remove:
apt-get purge sendmail*
sudo apt update sudo apt install sendmail sudo sendmailconfig sudo systemctl restart apache2 sudo systemctl restart sendmail
This ultimately was a failure, as it did not fix anything. This was taking a large amount of time to figure out so I stopped sendmail:
sudo service sendmail stop
I then moved on with other things.
I happened to be verifying ports:
sudo lsof -i -P -n
when I noticed this:
sendmail- 124017 root 4u IPv4 1255413875 0t0 TCP 127.0.0.1:25
?Interesting? My sendmail had stopped, but somehow the port was still on. What was going on?
I killed the process:
With a lot of hopeful thinking, I restarted my sendmail service:
sudo service sendmail start
I checked the ports again. The sendmail port was up and listening, so I decided to give it one more try. I tested my email as I did in previous steps, and lone and behold, it Worked!
I still am not entirely sure how the service could be closed, and the port still open. This was more so a case of dumb luck than intense knowledge in debugging sendmail, but these steps may be useful to someone that for one reason or another is having trouble with sending mail from a server. Overall, I wish I had this knowledge prior to the issue, as I would likely do all of these steps in reverse.
If you are having trouble with your email on WordPress, leave a comment related to what is happening, and if you would like, I can attempt to help you through your unique situation. Hopefully this page can become a source to help others with this very un-fun problem.