Smarthost and same internal/external domain name and users

Local server and remote server with same domain name.

Smarthost configured to use remote SMTP with a user named the same as a local one (i.e. both serves have user@domain.tld). Mail server was not installed.

After installing nethserver-roundcubemail for internal use, e-mail notifications to user@domain.tld are delivered locally (not through the smarthost, not delivered to remote server).

To be able to deliver through smarthost changed destination mail for notifications for an e-mail address not matching a local user.

Is there a better setup allowing same local/external e-mail addresses being able to deliver externally?
Even if dovecot and postfix were to be restricted to green LAN?

@dnutan

Technically, what you want (I’ve done that too, for clients!) really violates a few RFCs on SMTP and DNS. Nevertheless, still doable!

A few tips to get it going:

Internal and External DNS must be separate (two different MX needed) = Split DNS.
Internal can resolve almost all external DNS records, the external one not!

Basic Magic to do the trick: a subdomain for mail…
eg: YOURDOMAIN.com is your domain.
Internal main Domain name would be something like int-mail.YOURDOMAIN.com

Users on the external server would be:

Joe Miller (joe.miller@yourdomain.com)

Users on the internal would be:

Joe Miller (joe.miller@int-mail.yourdomain.com)

Internal users also get a mail alias same as the external user-mail.
Mail arriving at the external Postbox gets forwarded (Or use POP3 pickup) to the internal Mailbox.
Smarthost is the external server, using IP on the internal server, and a dedicated user like smtpuser@yourdomain.com (on the external server).

YMMV, but this should work as required.

Andy

Thanks for the reply.
Actually all e-mails are handled by the mail hosting provider.
Internal server was already setup as server.domain.tld resulting in mails having user@domain.tld, matching external domain. I could add a new mail (sub)domain to NethServer but don’t think I could change the current one. I don’t plan to replace existing hosted e-mail with NethServer.

Background info:
At the moment access to the internal mail is only required as a searchable archived copy of external one. Didn’t want to lose messages but needed to free-up space on one of the mail hosting providers. As I didn’t had time to properly test e-mail archiving applications (i.e. mailpiler) and the request was kind of urgent, used imapsync to get all messages from the hosting provider to a local Maildir through IMAP, just for one mailbox:

Host1 Nb folders:               15 folders
Host1 Nb messages:          231074 messages
Host1 Total size:      90249533534 bytes (84.051 GiB)