Postfix not delivering emails to external MX for locally hosted domain

I’ve got mx records pointed to Zoho on one of my domains and email generated from the wordpress site on the same domain (forms, site notifications, etc) is only getting delivered locally. It’s almost like it’s ignoring the mx records entirely. I can see in rainlloop that messages are getting delivered to that address locally, but not to the mx at zoho.

Email sent from rainloop, or gmail, thunderbird, etc works fine. I can email the zoho account from them. It’s just the email being generated from the website.

Anyone have any idea how to resolve this?

Edit: Someone with the same issue actually posted a solution here: Postfix not delivering emails to external MX for locally hosted domain · Issue #706 · usmannasir/cyberpanel · GitHub @usmannasir - Would you recommend doing something like this? Would it break anything? Is it the best workaround right now?

Hello @Tim Happy you are here

I do not understand what you mean by locally but you can check the settings of your wordpress plugin.

I do not understand what you mean by locally but you can check you snappymail configurations for all domains. Go to https://SERVER_URL:8090/snappymail?admin → Domains → * test your settings here

Thanks @josephgodwinke, actually, I’m using Rainloop. However, testing SMTP and IMAP configurations reveals there are no issues there.

I’ll try and explain what I mean in a different way. I have domain.tld on cyberpanel. There is an email address set up (initially on cyberpanel): user@domain.tld.

Later, my client decides he wants to use Zoho for email. I create with mx records pointing at at zoho. I create the same email address user@domain.tld on Zoho. I test the records, everything looks fine. I can send email to user@domain.tld and he gets them in his inbox at zoho. All is well (or so I think).

Next day, he sells something at his website at domain.tld (still hosted via cyberpanel). The website sends the order info to user@domain.tld (same as always) - but the email is not being sent to Zoho. The message remains only on the local mx server (I can see it via rainloop).

At first I think, well maybe this is a DNS propagation thing, give it time, but a couple days have passed with the same results. TTL on those records is only an 3600. I concluded that somehow, when the website is sending mail, it somehow isn’t obeying the mx records. It’s almost like postfix on cyberpanel is ignoring the mx records when it comes to mail originating from the website running on cyberpanel and not passing them to the mx at zoho. Does that make sense? I mean, he gets email to user@domain.tld (at zoho) from everywhere else. The only emails that aren’t hitting his inbox at zoho are the ones originating from his website running on cyberpanel.

After thinking this through, I admit I might be barking up the wrong tree here. I should probably just delete the email address on cyberpanel. I don’t see why I should have to though. Postfix should be sending all email for that domain to zoho.com, shouldn’t it?

I’ve had very few issues with cyberpanel (I really like it), but the troubles I have had are just about all email related. This is due mainly to my lack of knowledge and I’m not saying there’s a bug or anything like that. I’m just trying to figure out what’s going on. Thanks for your time.

Is it a wordpress website ? is he using native wp_mail function using php or smtp ?

Yes, wordpress. Native wp_mail with no email plugins.

Well let’s try the php mail function if it works as expected

<?php
$to = "info@zoho.com";
$subject = "TEST";
$message = "Dear TEST, Success email got delivered.";
$headers = "From: no-reply@serverdomain.com" . "\r\n" .
"CC: sysadmin@yahoo.com";
mail($to,$subject,$message,$headers);
?>

Then run https://websitexyz.xyz/testmail.php

Good idea! Running the script gets me an email in rainloop (on cyberpanel). Waiting to hear from my client to see if he got one on Zoho. It’s early in the AM here, and as he’s not a developer and still possessed of his sanity, he’s probably asleep. But I’ll confirm as soon as possible. If what I’m thinking is true, he probably didn’t get it.

I also CC’d to my gmail account and got a copy there. Again, whether he got the email at zoho or not, it’s weird that I’m getting one locally at rainloop considering email for the domain has mx records pointing to zoho. Thanks again.

He did not receive the email at Zoho.