Problem with wordpress mail (knowledge base article doesn't work)

Hi there,
I’m experiencing some issues with system mail from Wordpress (woocommerce order mails etc).

I host my mail on a separate server where my domain is also located. I will call this Domain Server for reference.
I also have a server where the Wordpress site is hosted (a vps). I will call this the VPS Server for reference. These 2 servers are not under the same ip.

The nameservers of this domain are pointed to Cloudflare.
I have DNS records for email pointing back to the Domain Server, this works flawlessly for normal e-mail.

I have DNS records for the website pointing to the IP of the VPS Server which works flawlessly as well.

Now I have E-mails sending from the Wordpress system for new orders etc. But these e-mails are sent to spam.

What I think is happening is that I’m sending emails from the VPS server IP but the Domain Server is set in the A record for mail. Which is creating an error.

I have tried using WP Mail SMTP and Easy WP SMTP but these both result in the following error:

SMTP ERROR: EHLO command failed: 550 Bad HELO - Host impersonating domain name [pctoppers.nl]
CLIENT -> SERVER: HELO pctoppers.nl
SMTP ERROR: HELO command failed: 550 Bad HELO - Host impersonating domain name [pctoppers.nl]
SMTP Error: Could not authenticate.CLIENT -> SERVER: QUIT
SMTP Error: Could not authenticate.

What do I need to change in order for this to work?
If you need more information please let me know.

Thanks in advance.

1 Like

Have a look at SMTP Error: Could not connect to SMTP host. (550 Bad HELO) | WordPress.org and 550 Bad HELO - Host impersonating domain name · Issue #1095 · PHPMailer/PHPMailer (github.com) for some further information about it.

1 Like

I see, thank you.
Before I go about changing the Host to Hostname, my site address is not with www. but just the domain and tld.

Would this matter?

On a Wordpress Site, how would I go about changing that option?

Is your Wordpress server using your mail server to send mail? That is, you have Wordpress on pctoppers.nl set up to use mail.pctoppers.nl as its SMTP server?

So, pctoppers.nl (wordpress host) is connecting to your mail server at mail.pctoppers.nl and identifying itself as pctoppers.nl. The wordpress host has no reverse DNS, but that’s not the actual reason for the error. The error is happening because the mail server at mail.pctoppers.nl is configured to see anyone claiming to be pctoppers.nl (a locally-hosted domain) as illegitimate. Basically the mail server is saying “you claim to be this domain, but this domain is hosted by me so that can’t be right.”

mail.pctoppers.nl is using Exim. There is something in the server config that denies connections claiming to be from domains the server hosts. Look for something like HELO_IS_LOCAL_DOMAIN in the exim configure file. It probably looks something like this:

deny message = HELO_IS_LOCAL_DOMAIN
    condition = ${if match_domain{$sender_helo_name}{+local_domains}{true}{false}}
    hosts = ! +relay_hosts

If so, easy fix: add pctoppers.nl to relay_hosts. More generally, your mail server needs to be told to trust your Wordpress server for relay.

Hi, thank you for the very detailed explanation this is the best one I have seen on the internet so far.

The exim.conf file, where do I edit this? On the mail.pctoppers.nl server or on the pctoppers.nl server?

Again, thank you a ton for the detailed response!

On mail.pctoppers.nl. If there is indeed a line like the one with relay_hosts in it, there should be a file near the config file called relay_hosts. Add your web server to that file. You should add it by IP address. If there is no such file, then it should be a list right in the configure file with a list of trusted relay hosts. However it’s done, you need to add the IP address of your web server as a trusted relay host.

Aha okay, well mail.pctoppers.nl runs on a DirectAdmin reseller account… I’m not sure how I can add something like that but I’ll definitely contact the admin.

1 Like

Hi @i40west
I’ve asked them to add it but since its a shared server they wont.

Is there any other way I can solve this? I read something about adding public $Hostname = ''; somewhere. But I have no clue where I should add this.

Any help is greatly appreciated.

Thanks in advance!

The alternative would be to have a mail server on your VPS that Wordpress can use to send its own email. If that’s an option and you know how to set it up, you would just need to make sure to add the VPS address to your SPF record.

Or you could get an account at SendGrid to send Wordpress email. You can actually use a Wordpress plugin that talks to SendGrid and it’s pretty easy to set up. Again, you would have to add stuff to your SPF record.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.