Need Advice on custom website configuration - remote EMAIL server

Hi, I need to run a website with a special DNS configuration and can’t figure to make emails to work.

My client manages himself the DNS and has a dedicated Mail Server, only the website is pointed to Cyberpanel IP.

Practically the email routing should be Remote Mail Exchanger, but I can’t figure how to configure.

What I tried:
I created the website under Cyberpanel and after that, I modified MX in local DNS records to the client’s mail.domain.tld and IP then ai restarted.

I tried to send an email from my personal account on the same CyberPanel server, to one email address of my client (email working on dedicated email server).
Seems that the email server tries to deliver the email on this server, Cyberpanel one where the website is defined, not to the remote one.

All emails sent from my server, even those from webpage forms, failed to reach the client’s email server, all of them landed on this server, are not sent to the desired server.

I tried all day to find a workaround to make the things working but with no success. Please can anybody enlight me how to manage and configure such a situation?

Thank you

domain.com / domain1.com are hosted and DNS managed on CyberPanel
domain2.com DNS managed on awsdns and www pointed to CyberPanel IP
mailserver.domain2.com pointed at other IP - an exchange server

my MX record:
MX domain2.com 3600 mailserver.domain2.com

ping to mailserver.domain2.com revolve to correct IP

I’m missing something but I don’t know what

Reporting-MTA: dns; hostname.domain.com
X-Postfix-Queue-ID: 885085C94A
X-Postfix-Sender: rfc822; [email protected]
Arrival-Date: Fri, 24 Apr 2020 00:55:38 +0200 (CEST)

Final-Recipient: rfc822; [email protected]
Original-Recipient: rfc822;[email protected]
Action: failed
Status: 5.1.1
Diagnostic-Code: x-unix; user unknown

I tested various configurations today, unfortunately, I do not find a functional solution.
Seems that CyperPanel does not have the ability to switch the email routing from local to a remote exchanger.
Default any website has a local mail exchanger; I set in DNS the MX to point to other destination but Postfix does not honour the MX entry.
Postfix keep trying to deliver the mail locally, where there is no email address.

After that, I tried to play with MANAGE SMTP HOSTS
On this page, you can manage STMP Host. (SMTP hosts are used to send emails)

Here appear default registered the localhost, which I deleted at some point to test without. I tried to register an external connection but I do not success to pair the servers.

All my tryings failed with Postfix / Dovecot keep looping local and searching to a user who does not exist.

A bug or missing functionality, I really don’t know. Need some clarifications from somebody who knows better the CyberPanel system.

As nobody come with clarifications from the developers, I continued with some tests.

  • Fresh CentOS 7 install + CyberPanel 2.0
    2.0.1 failed to instal due to some MariaDB missing repository.

Now let’s do some tests:

  • Created the new website (let’s name it - domain2.tld) but not checked Create Mail Domain at additional features because in this particular cases we want to use a remote mail server, and I want to try this clean website only vhost.
  • Email Policy Server disabled

Works. Postfix honour external DNS management and deliver the emails right to the correct remoteMX.domain2.tld
All emails exchanged between other domains in the server and the remoteMX.domain2.tld delivered perfectly.

  • I enabled the Email Policy Server - And the problems started.
    ! IMPORTANT - First just enabled policy without accessing the Email Limits page.

The emails were exchanged correctly between servers (the local and remote one)

In the email logs, I observed this line when an email from remoteMX.domain2.com server was received for an email address for another website in the local server.

connect from remoteMX.domain2.tld[xxx.xxx.xx.xx]
warning: connect to /var/log/policyServerSocket: No such file or directory
postfix/smtpd[8788]: warning: problem talking to server /var/log/policyServerSocket: No such file or directory
remoteMX.domain2.tld[xxx.xxx.xx.xx] not internal

When sending an email from email address for another website in local server to the email address on the remoteMX.domain2.com - emails are delivered but with a warning in logs regarding the policy:

warning: connect to /var/log/policyServerSocket: No such file or directory
postfix/submission/smtpd[9057]: warning: problem talking to server /var/log/policyServerSocket: No such file or directory

! IMPORTANT - Now on the CP interface I accessed the Mail Setting > Email Limits page
Just access the page, and do nothing there, leave DISABLED the limits for that particular domain with remote MX server.

From that moment, the warning regarding missing file for policy disappeared, probably the policy was updated and a file was created
Emails stopped to work.
We can receive emails from remoteMX.domain2.tld but we can not send emails back.

relay=dovecot, delay=1.2, delays=1.1/0/0/0.05, dsn=5.1.1, status=bounced (user unknown)

So there are some problems with the Email Policy Server.
@DEVELOPERS please register as a possible bug and investigate the situation.

For now, CyberPanel can’t be used with Email Policy Server Active and a remote exchange server.

I am having the same issue currently. Everything is working great. I am using gsuite currently. I am unable to send out the emails to my gsuite email ID. Cyberpanel simply does not talk to the remoteMX for sending out the email.

Just running into this problem myself. I have numerous client sites and none of them need email hosting from me but we do need to be able to send email to them from their websites.

2021-09-03 16:15:31 SMTP ERROR: RCPT TO command failed: 550 5.1.1 [email protected]: Recipient address rejected: User unknown in virtual mailbox table

Hopefully I’ll figure out what postfix needs for a configuration to avoid this issue. Has anyone else had this problem and fixed it?

Did you manage to solve this? I’m struggling!