Sendmail issues with WP admin

I noticed that my two WP instances are not sending admin emails. Sendmail seems to be installed on my server (Ubuntu 20.04), which is the default setup believe. I know having your server send emails is notoriously unreliable (they can get flagged as spam), but that’s not the issue here. The problem is the server can’t send email at all. And this causes issues because if you do something like say try to change the WP administrator email or a user’s email, it tries to send a confirmation email, but because it can’t the settings page just hangs.

Using a plugin to test I can trying to send an email through the server (sendmail) returns a “504 Gateway Time-out”.

One thing I did try already was sudo sendmailconfig and agreed ‘yes’ to everything, as recommended on several tutorials. Unfortunately the server is still not sending anything. Hopefully someone can help get this working…

I’m not 100% sure but this could be related to all the sendmail related php extensions not being installed. I thought of firewall first but since this is an outgoing connection, I don’t think firewall is an extension.

Also, can you try running the following command from your server?

echo "Subject: sendmail test" | sendmail -v <YOUR EMAIL ADDRESS>

Oh ya I forgot to mention I had testing using sendmail directly on the server and in that case ya it does send. But just tested it again using the above. It takes a minute or so, but it does send the email. It goes my spam of course, which is expected, but it actually does send.

But when trying to send an email from the WP admin or a front-end form is submitted, then it still hangs and we get timeout.

I have some KEY info to add to help you troubleshoot this…

I tried creating another fresh WP site (cleaver.rocks domain). And I think I have may have found two bugs in one! As I think other users have mentioned when going through the actual WP install process on the final page you end up with a 504 Error. I did again just now, as I do each time I install a WP site with Cleavr.

I did however receive the initial “New WordPress Site” email from the server. However, if I go to the WP admin and do something that generates an email, ie. update “Administration Email Address” in General Settings it still times out (as per my original issue). Also, importantly you end up with a 504 Error again. This time however, no email is sent from the server it seems.

Hopefully that makes sense, and hopefully will all the details it helps you figure out if both these issues are maybe the same thing. Please let me know if I can assist troubleshooting this further.

@onetrev - you got an error on initial setup as mentioned in this post? New WordPress setup error

I just tried and didn’t get an error…

Do you remember what PHP version and database you used?

Hey @amiedema … Yes, I do know, I’m using: PHP 7.4 / MySQL 8.0.

Curious then if yours doesn’t error out on install, does your sendmail work, as in can you do something like change the Administrator Email Address and the page saves (thus the email to confirm change gets sent)?

It takes a minute or so…

Maybe that’s why it is timing out. By default php’s max_input_time is set to 60 secs. You can try bumping it to a couple of minutes or set it to -1 and see if that resolves it. You can do this easily from within Cleavr from the Server > Services > Config PHP tab

I was able to successfully install with 7.4 / 8…

Also, yes I was able to send test mails. Though, I never get emails from WP to my gmail account. Gmail may block WP generated emails altogether. They do get sent to my Yahoo junk folder. I’d typically recommend using a plugin to send mails via SMTP for this reason.

Using this plugin is a simple way to see if WP emails are successfully sending or not - https://wordpress.org/plugins/check-email/. If there is an error, then yea I agree, there may be a tie-in between emails not sending and the error experienced on setup.

Give Ashok’s suggestion a try and let us know if that works or not.

So just to be clear again this is 100% not about emails not getting through, i.e. going to spam. I tried to make the clear in my original post – it is not about that. I know a lot of NOOB users have that issue. And so this is not WP support, which I’d say is not your job. :slight_smile: This very much look to be a server issue. I’ve fired up well over 200 WP sites over the last decade so I know my way around, and this is new issue to me.

I tried the email test plugin (though I’d already done the same thing with another plugin as mentioned above). Also tried setting my max_input_time to -1. And as expected, all my sites still 504 Error out any time email is involved. So unless I activate a SMTP plugin that hooks to MailGrid, I can’t send a frontend email (form submit), I can’t save a WP admin page that sends an email, etc. I’ve fire up 5 WP sites now, and every one has 504-ed too on install. Major bummer. When WP is using MailGrid, everything works – my forms send, WP admin pages save instantly when email update is involved, etc.

At this point I guess my last resort is to try and spin up a new Digital Ocean instance and connect it to Cleavr and hope it works… :cry: I would rather not see one of these again…

Does anything relevant show in the NGINX logs after the error occurs?

cat /var/log/nginx/error.log

Nothing in there but an image upload fail.

But since @amiedema you said you had no issues I figured it was just time to try an new server setup. And boom / relief, with my newly provisioned server everything works!!! I can fire up a WP site and no 504 Errors! WP admin can send email with no errors!

So my guess is at some point something in Cleavr’s setup was causing this, but it went away, so anyone provisioning newer servers didn’t have the issue. That’s my total non-server admin expert guess anyway. :slight_smile:

We could probably even delete this thread, not sure it’s of use to others really. And if you guys want to hack away at my server once I move everything off, let me know and I can provide access. Thanks and so sorry we all had to spend time on this. Damn technology, who needs it! :wink:

No worries!

This all seemed to be a phantom issue. We honestly didn’t do anything (that we know of) to introduce it or resolve it… :man_shrugging:

Maybe someone power cycled PHP. :wink:

Oh just to clarify, the old server is 100% still broken. WP 504s on every install (as it has since I first spun up the server a month ago with Cleavr). Sadly I had already rebooted that thing more than a few times in my hours of troubleshooting before getting in touch. :slight_smile:

It would have been nice to have been able to fix the original server, but a few more hours at this point to setup a new server that actually works, hehe, is worth it…

1 Like