Multiple email domains in a single account

Cheers! I am looking for how to use two mail domains with a single inbox and outbox, that is, I want to have a main domain and an alias domain.

I need the same user to be able to use [email protected] and [email protected] with the same inbox.

I appreciate the help you can give me.

You canā€™t then only that you can use is an alias to send mail to the ā€œmainā€ account

So create domain1.com and then set domain2.com as an alias of domain1

Create [email protected]

In your email client you can configure identities so that an email incoming to [email protected] will be answered from that account.

Alternatively, you may create domain2 and [email protected] and redirect all emails to [email protected]

Furthermore, you can also create a catch-all account in domain2 and redirect all emails to [email protected]

1 Like

How can I convert domain2 to alias of domain1 from hestiacp?

I have created [email protected] and [email protected], I want to be able to use [email protected] and [email protected] in a single mailbox.

If I create both domains and I create both users in both domains I know I can forward from domain1.com to domain2.com, but it would be two mailboxes.

Catch-all would send all emails from domain2.com to a single email.

You canā€™t just need to add a redirect for domain2.com

Thanks for your help, I have another question: How can I reinstall rainloop? By mistake I deleted the plugin to change the hestia password and it doesnā€™t appear in the packages to install again.

I had used the command v-add-sys-rainloop to install.

You can remove the /var/lib/rainloop

And run the command again.

1 Like

But will the domain2 then receive mail in the same Inbox as domain1 ?
If I ā€˜redirectā€™ a domain1 to domain2, will this apply to email user accounts too?
How does the system know userX of domain2 is the same as userX of domain1 ?
Creating forwards for hundreds of users should not be necessaryā€¦

Isnā€™t this really the basics of exim? It is for postfix. In exim it seems to be:

My Exim knowledge is way limited sadly. If you want to help feel free to submit a PR with the required config changes and I will try to get it working if I have more timeā€¦

https://github.com/hestiacp/hestiacp/pulls

Or join Discord:

But we store the aliases in:
/etc/exim4/domains/domain.com/aliases

Thatā€™s why you can set an email domain as an alias of another email domain

So how would we implement this using exim, while not messing up the current /etc/exim4/domains routing?

It is all in here, but as with eris, my knowledge of exim is very limited (Iā€™m a postfix guy)ā€¦
So, to be clear: This is about having to avoid creating hundreds of forwards for all users in @domain1 to @domain2 (where they have their mailboxes). So, these are domain aliases, not user aliases.

Iā€™m assuming this would need to be in config somewhere;

virtual:
  driver = redirect
  domains = dsearch;/etc/mail/virtual
  data = ${lookup{$local_part}lsearch{/etc/mail/virtual/$domain_data}}
  no_more

but what the syntax for $domain_data needs to be is totally not documented there by exim. No examples, which is also horrible BOFH behavior.

Use the web backend.

Choose an user, then a domain and set the alias in the configuration page

That is for web I donā€™t see an option for Mail domains

I think youā€™re totally missing the question;

[email protected] has a maildir under domain1.tld, they see it using webmail.domain1.tld
[email protected] should also go in that same maildir of domain1.tld

i.e. itā€™s a domain name alias for mail delivery by exim, not related to web/nginx.

I was not missing the point. The thing is that I thought that hestiaCP supported email domain aliases in the backend.

As @eris pointed out, it only does for webs.

There are a few things that you can do:

  • struggle with exim
  • create an empty mailbox with a redirection for the ā€œaliasā€ domain for every mailbox created.
  • create a link with ā€œln -sā€ of the maildir directory of the alias domain.

It supports it local part level but not domain level

The way to go.

But if I need to start testing and debugging at least allow than for

This is far from idealā€¦

Donā€™t think it will work. You still need to have a list of the existing accounts inte config

$domain_data = is the domain of the email part.

How ever tried it and it doesnā€™t work there are more changes required

I have email domain aliases working. I made these changes:
1: create a backup, and test that you can restore in case things go wrong

2: create a file /etc/exim4/domain_aliases with on each line:
{aliasdomain}: {existingdomain}

3: edit /etc/exim4/exim4.conf.template right under the line begin routers add the following:

domain_aliases:
  driver = redirect
  data = ${extract{1}{:}{${lookup{$domain}lsearch{/etc/exim4/domain_aliases}{"$local_part@$value"}}}}
  require_files = /etc/exim4/domain_aliases

4: in file /etc/exim4/exim4.conf.template find the line that starts with
domainlist local_domains =
and add
;/etc/exim4/domain_aliases
to that line

5: in file /etc/exim4/exim4.conf.template find the line that starts with
domainlist relay_to_domains =
and add
;/etc/exim4/domain_aliases
to that line

6: reload exim4 so it starts using the new configuration
service exim4 reload

7: now all mailmessages to userx@aliasdomain will go to userx@existingdomain

3 Likes

If you want please submit a PR with the Changes required it would be a great add on

2 Likes