SMTP Host for each domain (external relaying domain)

Is it possible on a NETHSERVER to map the following situation?

I want to host multiple e-mail domains in an internal network on a NETHSERVER. Specifically, each user can have multiple e-mail addresses.

One domain is hosted by NETHSERVER itself and other domains (such as,, are to be picked up only the mail with fetchmail and moved to the respective mailbox.

Is it possible that I for these other domains (such as,, each own SMTP - Server furnish so from these addresses can also be sent mails. In Exchange is it referred as “external domain Relaying”.

Thank You

Hi @rosi_steiner,

NethServer is currently designed to provide the mail services for its mail domains only, possibly using a smart host as default route or relay to other servers for specific domains.

AFAIK, mail handled by other providers (gmail,gmx,ms) should be configured into each mail client: certainly the external relaying domain feature living in Exchange has a specific use case scenario that I can’t figure out. Could you provide more details about it?

1 Like

I need a mail server on the intranet.

With this I want each user to manage multiple e-mail addresses. The e-mail addresses of all other domains, such as, etc. the intranet users need to work on different computers, so I put the mail with IMAP available. On each computer that will so the same mails be available and downloaded only once.

Fetching the mail from these email providers I’ll do with fetchmail and put it in the server locally from.

I am now looking for a way for these external mail - domains for each user the correct SMTP - to use server so that, for example, is sent via the SMTP of

Greetings and thank you


If i’m getting your request right, you want multiple smarthost choosed automatically, for each email, by sender address. Right?

This where a BIG POINT.

But my wish is only to install one smarthost manualy for every external domain. I will send e.g. any emails with the - SMTP and so on.


I have this same requirement. I currently use postfix with sender_dependent_relayhost_maps which chooses a smart/relay host based on the senders @domain address.

Why do I do this? It allows me to keep a single point of configuration for clients (server details and username and password) on the LAN instead of configuring separate SMTP details per email address.

Can I manually edit the Postfix configuration files to permit Sender Dependent Relyhost Maps without breaking NethServer?

I really want a Linux based all-in-one home server instead of an AD, File server and hMail server running on Windows.

Any pointers would be appreciated :smile:

You need a custom template to make the configuration “permanent”.
See the developer manual:

In case of doubts, show here the modifications you need to make and we will help you.

Thanks Filippo.

(Pulled from my working test server VM, CentOS 6.5 which I was testing about 1.5-2 years ago before going with hmailserver)

:: ::
smtp_sender_dependent_authentication = yes
sender_dependent_relayhost_maps = hash:/etc/postfix/sender_relay
smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/isp_passwd

sender_relay DB has 2 columns, usernames and forwarding hosts.
isp_passwd DB has 2 columns, email address and username:password

forwarding hosts were set as which forwarded to stunnel (for SSL Port 465 connections to ISP’s mail servers).

The stunnel configuration file /etc/stunnel/stunnel.conf is configured with ISP’s e.g.:

client = yes
accept =
connect =

client = yes
accept =
connect =

client = yes
accept =
connect =
protocol = smtp

(My wife signs up to multiple free mail services and no amount of pleading stops her ;))

From the mail client I setup email aliases for each ISP email address and then its a case of selecting the desired ‘send as’ address to use and the server relays to through the relevant ISP.

So I believe with Templates I can add the additional Postfix configuration to Postfix and point the additional files to my sender_relay and isp_passwd DB’s.

Stunnel will need to be manually installed and configured separately. Will this cause any issues with mail filtering or mail flows and is the above the correct approach?

Many thanks,


did you finally got your answers? You talked about your wife - but me and my wife, we have 3 children with their own emails addresses :smiley:


Feature in progress, tracked by