NS8 Smarthost for sending mail

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

IS this, Where the Smarthost MAil settings are entered from in the UI

For use by other modules, as documented here?

SMTP smarthost | NS8 dev manual (nethserver.github.io)

if so, it does not test the email connection and server settings,

there is no way to very if sending works, by test sending an email to a designate email.

@davidep any priorities defined for these?

1 Like

We test it by login to the remote smtp server you cannot be sure that if you send the email it could be accepted by the mail server

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

4 Likes

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[213.165.67.97]:465, delay=209, delays=189/0.05/20/0, dsn=4.4.2, status=deferred (lost connection with smtp.ionos.de[213.165.67.97] 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.

EDIT:

Maybe wrong encryption?

2 Likes

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://distfeed.nethserver.org/ns8/updates/
"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

thanks a lot for your advice !!!

Moin @hucky,

https://distfeed.nethserver.org/ns8/updates/

On the right site of this is a Field with Name Testing. You must activate the Testing repro and then the field will be green. Then you can start with the installation of the new smtp modul.

Regards…

Uwe

2 Likes

i activate the repo and update the core and the mail app, is there something new for the configuration or is this all?

i saw there is a new entry at notification:
smarthost.configuration
smarthost.manual_configuration
smarthost.mail_app_instance
which one is the right for smtp relay?

Yes, there are relay rules in the mail app, see Nextcloud (ns8) email notify error - #20 by mrmarkuz

I think if you have mail server installed then smarthost.mail_app_instance is the right one. You can set the smarthost in the mail app now…

1 Like

if i do the notification change to smarthost.mail_app_ instance i have no possibilities for give relay server adress and the mail dont leave the ques and i got an dont allowed to talk error, if i return to the smarthost_manual_configuration i can do it with a relay server, but it did not work, there is the same error like before.

Did you add a relay rule?


i did not have the entry

Revision Instanzmail1

Version1.4.0-dev.2