Recently, a client contacted me regarding a WordPress installation that has its Contact Form 7 (CF7) not sending emails. The installation was served on a Cloudways Hosting Platform (CHP). CHP has a feature that sends email via gmail’s SMTP.
SMTP stands for Simple Mail Transfer Protocol. When you send an email, your server simply uses the SMTP Protocol to connect to the recipient’s email server. So your server will be able to transmit your email content towards that server.
As with every troubleshooting, I would start with the obvious and move one step at a time to the least obvious. So based on experience, I see that the CF7 should be the best starting point.
The client told me that the website sent the emails before and then suddenly stopped sending. This happened several days ago. So, I checked the CF7 and look for the forms. Good thing, it has only one form.
So I logged into the admin panel then checked the sending tab and set my email to the recipient. This is to confirm that it does not really send emails. After that, I opened the front end’s form, filled it up and send.
I waited for a while then checked my email. But, I did not receive the expected email.
The next logical way would be to check the server. Before that though, I needed to check the Cloudways panel.
So I asked the client for access to his Cloudways panel. He invited me so I was able to log in.
Right under Servers menu > then selecting the server > then SMTP, we’d see the following:
I told the client to click “Update” and then input his credentials (gmail username and password). He replied that he already did that previously. So, if he did that and all his credentials are OK, then it would be better if we go to the server and check using SSH.
With some clicks on his Cloudways panel via Applications > Select what application > Access Details, I added an SSH user.
I encountered a problem when I cannot SSH. The server responded with:
ssh_exchange_identification: read: Connection reset by peer
SSH to Server
I searched the internet and found a solution here. Particularly, the solution is the one that discusses the connection error to cloudways. The cause of that error by the way, is having my IP blacklisted. So I whitelisted my IP and that is it: I was able to do secure shell to the server.
Using my bash shell, I used SSH to connect to the server. Since, the server in Linux, my knowledge on basic linux commands came to life when I navigate to the different directories of that server.
I then did the mail command to see if I can send an email. The command is like this:
> mail -s "This is the Subject" firstname.lastname@example.org This is the body of the email. this is a test to see if the email works. [CTRL+D]
To end the body of the email, use CTRL+D.
The mail command will not give you a response, but you can see the emails on queue with the command: mailq. The response I saw with the command shows me the culprit.
There were several emails on queue. The two most common reasons as enumerated were:
(delivery temporarily suspended: connect to smtp.gmail.com[2404:6800:4003:c02::6 d]:587: Network is unreachable)
(delivery temporarily suspended: SASL authentication failed; server smtp.gmail.c om[XX.XX.XX.XXX] said: 535-5.7.8 Username and Password not accepted. Learn more at?535 5.7.8 https://support.google.com/mail/?p=BadCredentials v9smXXXX016pfg .144 - gsmtp)
Upon observation, the username and password is really the culprit. So, I told the client about it. I further told that it could be possible: he entered the right credentials on the onset. But, later on he changed password on his gmail.
“And that is it.” He said. He remembers.
So there you go. A few days ago, he changed his password on gmail. His Cloudways applications cannot access his gmail SMTP since the passwords don’t match anymore.