NS8 Postfix change sender mail address

NethServer Version: 8 / Test Repository
Module: mail, sogo, nextcloud, imap_sync_collabora

Hello,

i need some help to change my sender mail address, because i have some mail addresses and i don’t own the domain. In NS7 i added these addresses to the /etc/postfix/generic file and it worked

In NS8 i tested the following, but then i cant send mails:

First command:
runagent -m mail1

First i edit the generic file with:
podman exec -ti postfix vi /etc/postfix/generic

strauch@local.domain strauch@public.domain

then:
podman exec -ti postfix postmap /etc/postfix/generic

second i added the following file:
podman exec -ti postfix vi /etc/postfix/main.cf.d/myoverride.cf

smtp_generic_maps = hash:/etc/postfix/generic

systemctl --user reload postfix

But it didn’t work. Anyone an idea what im doing wrong or what is missing?

Best Regards

strauch

Hi,

Cannot comment on whether your solution works or if it is the right way to accomplish your goal.

However found out posttix in the (Alpine) container abandoned the Berkey Database (hash) due to license issues. Nowadays it uses Lightning Memory-Mapped Database Manager (LMDB). Meaning postmap creates *.lmdb databases.

Instead of:

smtp_generic_maps = hash:/etc/postfix/generic

try:

smtp_generic_maps = lmdb:/etc/postfix/generic

However I do not think your solution will survive an update, the generic file should live on a persistent storage location (volume) such as /etc/postfix/main.cf.d

4 Likes

Hi Mark,

thank you, yes i saw it in the logs right now, that hash is not supported, i will test it, and move the file to a persistent storage location.

Thanks

1 Like

Thanks Mark,

i got it, here the solution for others:
First command:
runagent -m mail1

First i generate the generic file with:
podman exec -ti postfix vi /etc/postfix/main.cf.d/generic

In this file i wrote:

strauch@local.domain strauch@public.domain

then to generate the database file:
podman exec -ti postfix postmap /etc/postfix/main.cf.d/generic

you can check the file with:
podman exec -ti postfix ls -l /etc/postfix/main.cf.d/
you should see a generic.lmdb file

second i added the following file:
podman exec -ti postfix vi /etc/postfix/main.cf.d/generic.cf

smtp_generic_maps = lmdb:/etc/postfix/main.cf.d/generic

systemctl --user reload postfix

That works for me

Best Regards

strauch

5 Likes