Forums

Mansoor
Mansoor
Offline
Resolved
0 votes
I needed to receive emails for two different domains. ClearOS is very clear on not allowing virtual domains hosting for emails, as explained in this document: Does ClearOS Support Multiple Virtual Mail Domains?

My requirements were:

1. Messages sent to addresses on the two domains must be kept separated.
2. Replies must be sent from the original receiving domain, not from the clearOS main mail domain.

The clearOS can receive emails for different domains. Additional domains can be entered in Server → Messaging → SMTP Server → Destination Domains. The server keeps mails sent to all domains in one account. For example, message sent to user1@main_domain.com and to user1@dest_domain.com are all kept in user1@main_domain.com account. So, user1@dest_domain.com is just an alias for user1@main_domain.com.

Based on these facts, I had 3 options:

1. Install a virtual machine on KVM/Kimachi for hosting email service
2. Outsource email service
3. Find a way to use clearOS and meet the requirements at the same time.

The first option would complicate my network, as I then need to manage two competing mail servers at the same network (clearos' and the VM one).

The second option costs money and since the domains I host are not commercial, I don't want to pay for their emails.

This left me with the third option! Fortunately, I was able to do it and meet the requirements as explained in the following:

1. Configure clearOS to rely outgoing messages using a third party. I used sparkpostmail and added the required settings in /etc/postfix/main.cf:
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = static:SMTP_Injection:xxxxxxxxxxxx
relayhost = [smtp.sparkpostmail.com]:587
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = may
header_size_limit = 4096000
smtpd_tls_auth_only = no

2. Accordingly, configure the two domains' DNS hosting records at the registrar page.

3. The tricky part was to setup my email client (I'm using macOS Mail) to separately receive messages for the two domains. So, messages for user1@main_domain.com go to its own account and messages for user1@dest_domain.com go to its own account. This can be achieved by creating two POP accounts, then adding rules to each one as follows:

- If an incoming message is for account "main_domain.com" and recipients addresses contain "dest_domain.com", then delete it. (make sure the POP account is configured not to delete messages on the server)
- If an incoming message is for account "dest_domain.com" and recipients addresses contain "main_domain.com", then delete it. (make sure the POP account is configured not to delete messages on the server)

This trick keeps emails mixed on the server of course, but on the client, they are separated as if they came from two different accounts.

One limitation of this method though is when a message is sent to both domains. Then the client would not receive it in either account. In my situation this unlikely to happen as the two domains are unrelated to each other in the real world.
Sunday, January 14 2018, 10:09 PM
Share this post:
Responses (0)
  • There are no replies here yet.
Your Reply