E-mails got send from wrong maildomain

You can not.
I’m driving.
I will tell you later why and how to do. I have the same situation for 50 different domains.

@malvank please share the mail logs. Because now i have no opportunity to reproduce.

Also pls share
$myorigin from main.cf

You’re replying with one hand? And a eye on the street? :open_mouth:
Be careful!

1 Like

Don’t worry!
I’m writing only at the red light!:wink:

The send domain is chosen from the mail client.
You need to configure multiple identities inside your mail client and choose the right one when sending.

Hello Kristian,

Sorry for the late answer but I’m not in very good shape of health. Something between flu and bronchitis. The weather is changing very fast …

Please keep in mind that the NethServer is not designed to be an email server for complete separate domains.
NethServer is designed, till now, to act like an PDC with the possibility to have also an email server (and of course and other facilities but based on this task) to serve the primary domain and if exist, additionally virtual domains, as aliases domains for the primary domain.

(cc: @alefattorini, @giacomo, @davidep, @filippo_carletti: I hope is correct what I said till now)

In this forum there are a lot of Q&A regarding this task. Some of them:

NethServer for dummies: Email server
Multi-Domain/Multi-Tenat Groupware
Some question about E-mail and SOGO
Multiple, separate domains email server
Incomplete email address
One NethServer installation for N organizations?
Multi Domain support for mail
SOGO Email - Change the default from email sender

The same problem is for Zentyal.

Like I said, I use NethServer as email server for different domains but using an workaround. In a project, I have 50 email domains and each domain have at least one identical email address: “contact”.
How I solved this problem so as each email address, contact@domain.com, contact@domain1.com, … contact@domain50.com, to work properly?
Like I told you in my first answer, with the following remark: You cannot create two users with the same user name. For this, you must get another workaround. I have used this “technique”: for each domain, I have created “same user” like this:
User name: contact.domain (contact.domain1; contact.domain2; …; contact.domain50).
First name: Contact


  1. Account name = User name = contact.domain; contact.domain1; contact.domain2; …; contact.domain50
  2. I think that I seen somewhere, I’m not sure if in this forum, another way to create the same user for more than one time.

For me, how I solved this problem was the easy way and it works for about two years on Zentyal and on NethServer.

I hope that all of that from above will help you.


It is normal for postfix to send from one head domain, we should set up $myorigin and all domains which you have.

Hi Nas,

I never did that, with Zentyal or with NethServer.

There is no $myorigion in the main.cf as far as i can see it’s an postfix conig variable? Can you please be more clear what you mean?


I tried to find about “$myorigion” on “google”.
Nothing like in main.cf on NS.


The list may continue …

Hi Gabriel,

Thank you for such a thorough answer. I explain in more detail what I have done and what fails for me.

Like I already told you earlier i have create three different mail domains on the server. After that i create a user let’s call him/her USER in this explanation. Under services i have ticket the service for mail and per default the user gets created on all three domains . This can be changed by removing the pseudonym user@ and replace it with the specific domain i use but i want in this scenario be able to receive mails on all three mail domains.

I have not added the mail account user@example3.com to may mail program and phone. What happens is when I send a mail as user@example3.com it will be delivered as user@example.com to the destination recipient. So it seems that postfix can’t distinguish the correct mail domain.

Does this make sense to you?

I understand.

Maybe must be created a custom template in e-smith which will include

# Optional: send mail as user@domainname instead of user@hostname.
#myorigin = $mydomain

as is described here:


but I realy don’t know.
I’m sure @nas can help but I think it’s very busy.

You are referring to this? Basic Postfix Configuration

What domain name to use in outbound mail

The myorigin parameter specifies the domain that appears in
mail that is posted on this machine. The default is to use the
local machine name, $myhostname, which defaults to the name of the
machine. Unless you are running a really small site, you probably
want to change that into $mydomain, which defaults to the parent
domain of the machine name.

For the sake of consistency between sender and recipient addresses,
myorigin also specifies the domain name that is appended
to an unqualified recipient address.

Examples (specify only one of the following):

myorigin = $myhostname (default: send mail as “user@$myhostname”)
myorigin = $mydomain (probably desirable: “user@$mydomain”)

Yes, you can try to specify all your 3 domains in myorigin in main.cf and try.
If it works for you we can make custom template or even pass it to the production.

I think is better but I’m not a specialist …

AFAIK the client is responsible for the sender value. The server does not alter it by any means.

Hi Nas,

but there is no “myorigin” in /etc/postfix/main.cf

@nas, I think myorigin is good at default value in our setup, where local mail is not used

Who prevents you to add this parameter and make some tests :wink:

I’ll make a test as soon I have some spare time in the week.

Should someone have a configuration suggestion please post it. That will speed up the test.