Sending Email from Secondary Domain

Hi there,

Just finished setting up my Nethserver and I’m very happy so far. However, I’m having one tricky issue with email. I’ve read a number of posts describing very similar issues but haven’t been able to find anyone who resolves exactly what I’m struggling with.

I’m hosting a small email server (approx 12 accounts) on my business internet line (no smart host, port 25 is open). Most of the users are family members, but I have three work colleagues on a separate domain for our business.

Currently, I have three domains configured, we’ll call them family1.tld, family2.tld and work.tld. Family1.tld is the default domain. I don’t mind if my work colleagues login with user@family1.tld, but they need to be able to send messages as user@work.tld and that doesn’t seem to work. While they can receive messages at user@work.tld, all of the outgoing messages come from user@family.tld. Is there a way to assign a user a different outgoing mail domain? Surely, I’m not the only person wanting users to be able to send mail from a mail alias?

NethServer Version: 7.9.2009
Module: Email

Which is the software that you’re using for sending email?

Here is a basic idea you can work on:

1 Like

I use Apple mail. One colleague will probably use SOGo. I think the other uses outlook.

Interesting. I’ll give that a whirl. :slight_smile:


I notice that has an “autogenerated” warning. Do you know where I can make these changes in Nethserver and not have them overwritten? Is there an overrides file or something?


Try this:

I wrote this on the fly and haven’t tested if it works… but it should

First you need the directory structure that contains the fragment

mkdir -p /etc/e-smith/templates-custom/etc/postfix/
cd /etc/e-smith/templates-custom/etc/postfix/

Then create the fragment of the file:

vi 41sender_maps

and in 41sender_maps just write this line

smtp_generic_maps = hash:/etc/postfix/sender_rename

Save the file and give the command to regenerate /etc/postfix/

expand-template /etc/postfix/

If you go to see the file /etc/postfix/ you’ll see that it added the new line

You create the file /etc/postfix/sender_rename

vi /etc/postfix/sender_rename


save and then give the commands

postmap /etc/postfix/sender_rename
signal-event nethserver-mail-server-update

Worked perfectly! Thanks so much!

1 Like

I’d use only some client settings, but mr @saitobenkei ruled out a problem like a champ.


Thank you so much that’s what I wanted!

1 Like

Let’s make things more complex … Is it possible not only to rewrite the send email but also the reply to?

Configuring the email client?

Hi, I wanted this rewriting to take place automatically with postfix, as it already does on the sender.

This worked great for some time, but I’ve noticed recently that things are going a bit haywire.

I have my primary address we’ll call it and then I have a which should rewrite to At the moment, this is flopped. Anything I send from arrives from and anything from comes from

I saw this and thought, surely I must be misremembering and it’s been broken all along. So I went to check my /etc/postfix/sender_rename

It shows the proper mapping.

Could this have been broken in an update? Any suggestions on how to fix it?