Relaymaps for outgoing mails to providers

i am migrating from my opensuse to nethserver.
I need some settings for postfix for example relaymaps for outgoing mails to my providers and Also I need saslauth for authenticating via smtp.

I learned that I have to use templates for persistent settings. But if I create a template in /etc/e-smith/templates-custom/etc/postfix/relaymaps/00relaymaps it isn’t used.
I have created a folder with a file called 70relay. That doesn’t work too.

Could you tell me in which logfile I have to look into to find some error?
What service do I have to restart to apply my changes in the template folder?

I am using Nethserver 6.7

Thank you for your help.


Did you try the smarthost settings in the web UI? Perhaps a custom template is not needed…

Log files are
/var/log/maillog (described in the same link)

AFAIK relaymaps is not a template, thus the update events don’t expand it even if a custom-template is defined.

I need several smarthosts. One for, one for, …
This will only work with relaymaps in my opinion.

The logfiles are only for mail itself as far as I know.
I am searching for the logfiles which build the postfix config from the templates. Is there any?

Which process do I have to start to build the config from templates ?


This is not implemented at he moment. Could you explain your use case in depth? Why multiple smarthosts are needed?

I use nethserver as my one mailserver for incoming and outgoing Mails. I do not want to allow my Clients a direct connection to the providers via smtp. All Emails must pass my nethserver.

This is a common scenario, but I still don’t get why multiple smarthosts are needed :worried:

AFAIK the typical setup is:

  • authenticated/authorized clients send mail through the submission port of NethServer.
  • NethServer relays messages (with o without smart host)
  • The network firewall blocks mail ports to clients

I’m curious too, others asked it in the past but I can’t get the need. One smarthost isn’t enough?

I have to authenticate on some smtp servers.
Where can I define the credentials for these domains?
I found only one at the smarthost configuration.

These szenario exists mostly with freemail accounts.
Example: User1 has an account at
User2 has an account at
Both have to authenticate before they can use the smtp from these providers.

this doesn’t answer to the question: why do you need to auth to many external smtp servers?

I mean: usually you need only a single smarthost… this is true in 99% of cases… I know that if you’re using a solution like office365 it won’t work, as you must auth each user with its own credentials (this is how at Redmond try to fight spam…)

So what are the advantages of configuring the external providers as smarthosts on NethServer?

IMO it seems hard to maintain each account credentials. This configuration requires additional development of Postfix configuration and UI forms; I’m still not sure it is worth the effort.

However I like new ideas :wink: Could you share the Postfix configuration you have on OpenSuse?

I had written an really long explanation but if I click on reply I get the following error message:
Sorry, new users can only mention 2 users in a post.

Can I send you a PM Davidep?

I don’t like PM :blush:

Why not avoiding the mentions?

Sorry I do not know what as mention is interpreted.

A “mention” on Discourse is a @ followed by a username. A newly registered user has some limitations on the available features. Perhaps your text contains strings of that form?

Perhaps I explained the situation not detailed enough.
I have no idea how I can solve my situation without relaymaps and
sasl_passwd. If anybody has one please tell me.

The situation is the following. I cannot use only one smarthost because
all spamfilter would block the connection if you send mails with an open
So all mails have to send with the corresponding mailserver from which
domain you are sending the mail. Additional to that you have to
configure sasl_passwd for each emailaccount. I have replaced all @ with at.

So if you have the following emailadresses:
abcd at
efgh at
efgh at
abcd at
efgh at

you have to send the one from abcd at with the mailserver from with the smtp authentication user:abcd at webde pass: 123456

If you send from efgh at the email has to send with the mailserver
from with the corresponding authentication via smtp

I solved my situation by using sasl_passwd and relaymaps.
Here is an example strucure of both config files.

username at username:password

john at
smtp_sender_dependent_authentication = yes
sender_dependent_relayhost_maps = hash:/etc/postfix/relaymaps
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd

What have I to do for a persistent nethserver configuration?

Thank you for your help and being interested at my case.

I would like to know a solution as well. I have the same situation and couldn’t find the time to look further.

First of all I’m happy to say welcome on our community @Linux4All! Our community guy @alefattorini uses to greet newcomers every week but I bet he’s on holiday (as me and many others from Italy).

Before analyzing the configuration, I have a question here: why you say “open relay”? By default NethServer allows relaying only to authenticated clients. In other words it knows the sender identity before sending the message to an external domain.

This is exactly what the other mail providers do, gmail, for instance.

However I’m assuming you have a registered MX in DNS :smile:

1 Like

Davide, some providers needs 1:1 mapping between sending address “From:” and the auth credentials…

for example, almost all providers offering office365 services need so

for reference, take a look here:


Thank you @zamboni for the hint!

@Linux4All could you confirm this is the scenario you’re fighting against :wink: ?

BTW I hope Linux will be 4all soon!

Thank you for friendly welcome :smile:

That’s exactly what I fighting against and what I try to explain all the time.
Hopefully there will be a solution with Nethserver.
I tried a lot of distributions and SBS editions. Nethserver was the only one which survived more than 30 minutes :smile:
I think I will find some more enhancements which I need but the base is very good.

@davidep avidep: What can I do to have a persistent postfix config, until this feature is implemented, hopefully it will.