NS8 Smarthost for sending mail


While evaluating/testing NS8 on Debian 12 with (Samba) AD, Mail (and SOGo) I did not find where/how to configure an (external) smtp-host for sending mail (i.e smart-host) in the UI.

On the node is is possible to configure one for the notifications which seem to be configured oke:

{"port": 25, "host": "smtp.XXXX.nl", "username": "postmaster@XXXX.nl", "password": "MYPASSWD", "enabled": true, "encrypt_smtp": "starttls", "tls_verify": true}

In the end managed to configure it in the container in /etc/postfix/main.cf.d

$ sudo runagent -m mail1 bash
$ podman exec -ti postfix cat /etc/postfix/main.cf.d/smart_host.cf
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = lmdb:/etc/postfix/main.cf.d/sasl_passwd
smtp_sasl_mechanism_filter = plain, login
smtp_sasl_security_options =
smtp_tls_policy_maps = lmdb:/etc/postfix/main.cf.d/tls_policy

# global smarthost is enabled
relayhost = [smtp.XXXX.nl]:25

OT took me long to realize postfix does not understand the hash: type anymore it’s lmdb: nowadays…

Is the absence of possibility to configure an external smtp(smart)host for outgoing mail by design or something still under consideration?


Relay hosts configuration (or mail routes) formerly known as Smarthost in ns7 is a planned feature, still not implemented. In future releases it will be configured from UI.

Meanwhile thank you for the Postfix customization example. You read the docs, pure joy for me.

Mark, I’m really happy to read again from you (There will be a talk about ARM and NS8 at our community meeting Saturday afternoon at Fosdem, but I didn’t say it).


@mark_nl give us the gist after the discussions, would you

I did not test it but I think this should do it?

5 posts were merged into an existing topic: Pop3 connector feature

No, not for outgoing mail of the mail server-module.
At least for me it did not use this settings in de mail-module, but i did configure the outgoing smtphost for notifications after installing the mail-module. So maybe its because of this or configured it wrong. I’ll check again although pretty sure I did configured it correctly…

You did it right, Mark. By now your custom configuration is correct for routing messages from Mail through an external MTA.

Email notifications panel is for other applications and should work for everything but Mail.

The planned idea is:

  • add some button into the Mail configuration to easily change “Email notifications” setup and say to the whole cluster to route app messages through the Mail instance
  • add mail routing/relay rules to Mail, based on sender/recipient as NS7, or setup a default relay (like Mark did in the custom config) – the latter differs from NS7 approach but is equivalent in the end

The rationale behind this is that a cluster can have or not have a properly configured Mail module, and in some cases could have more than one Mail servers spread among the cluster nodes. In any scenario some applications need a SMTP server to send messages.


Did we have an howto for getting postfix run with an smarthost like ionos or other ones? i try it now for around two days but its seems allways that way the mail1 is sending directly to the other mailserver and sure i got the refused to talk to me: 554-gmx.net (mxgmx009) Nemesis ESMTP Service not available 554-No SMTP service 554-IP address is block listed. 554 For explanation visit 554 Nemesis ESMTP Service not available No SMTP service IP address is block listed.)

I am very curious about this smarthost thing, all modules have some smarthost component for automatically getting a mail detail and using them for smtp, but have been asking myself question on the where from…

it is rare that dev´s dont write a word… so is there a possibility in the future maybe? would be great to hear something…

@hucky what do you want to hear from the developers

4 posts were split to a new topic: Test connection and server settings of Email notifications

I needed to configure a smarthost but I didn’t use smtp_tls_policy_maps so here is what I did for a working smarthost:

Enter the mail instance environment, in my case mail1:

runagent -m mail1

Create the file smarthost.cf by using vi in the container…

podman exec -ti postfix vi main.cf.d/smarthost.cf

…and add following content:

relayhost = [your.smarthost.tld]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = lmdb:/etc/postfix/main.cf.d/relay_pass
smtp_sasl_mechanism_filter = plain, login
smtp_sasl_security_options =

Create the file relay_pass…

podman exec -ti postfix vi main.cf.d/relay_pass

…with following content like smarthost username:password:

your.smarthost.tld markus:SeCrEt

Create the lmdb file:

podman exec -ti postfix postmap main.cf.d/relay_pass

Restart postfix:

systemctl --user restart postfix


Hi @mrmarkuz, I did the steps and would like send a mail from CLI for testing… Could you please tell me the synthax?

P.S. I use Debian12 as OS.

Installing the mail command depends on a smtp server. (in the case of Debian exim is suggested). In the container one can install mail but I think it’s easier to just use a supported mail client like Roundcube for sending a test mail.

If you meant another Debian client and not the NS8 node, here is an explanation how to setup mail for sending a test mail.

1 Like

Worked perfect, thank you! Tested sending and receiving with roundcube…

1 Like

i made it to installing the postfix relay server from @mrmarkuz way to describe it. now the postfix try to send the Emails, but by trying to send it it comes to this situation
Apr 21 15:07:43 ns8 postfix/smtp[10116]: 2275B26C86D: to=kai40hh@gmx.de, relay=smtp.ionos.de[]:465, delay=209, delays=189/0.05/20/0, dsn=4.4.2, status=deferred (lost connection with smtp.ionos.de[] while receiving the initial server greeting)
any suggestions?

Let’s wait until the new Mail 1.4.0 app is ready. The modifications shouldn’t be necessary anymore.


Maybe wrong encryption?


i returned now the ns8 system to a state before i did the modifications for smtp relay. you think i should give it a try with the test repros? Also for, maybe a little helpful… ? i have to repros
"https://forge.nethserver.org/ns8/updates/ "
do i need to activate both?

Yes, just create a snapshot and give it a try.

No, just for the NethServer base repo (the distfeed one) activating testing is needed.
After activating there’s also a core update, I don’t know if it’s needed.

1 Like