Ns8 rewrite sender outgoing like ns7

The NS8 Mail app is customizable, see GitHub - NethServer/ns8-mail: NS8 Mail module with SMTP, IMAP, Spam/Virus filter, so I just adapted the @saitobenkei solution including that postfix seems to use lmdb instead of hash now.

So, let’s enter the mail app environment: (in this example the mail app instance is named mail1)

runagent -m mail1

Let’s create a cf file /etc/postfix/main.cf.d/rewritesender.cf for rewriting senders…

podman exec -ti postfix vi /etc/postfix/main.cf.d/rewritesender.cf

with following content:

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

So we need another file /etc/postfix/main.cf.d/sender_rename holding the mail addresses to rewrite…

podman exec -ti postfix vi /etc/postfix/main.cf.d/sender_rename

with that content for example:

user@orig.mailadd1.org u.name@rewritten.mailadd2.com

Map file:

podman exec -ti postfix postmap /etc/postfix/main.cf.d/sender_rename

Restart postfix to apply the changes:

systemctl --user restart postfix

That’s it, mails should be rewritten now.

I think it’s already on the todo list but for now you could use following manual config:

3 Likes