Postfix wrong From address when sending email

13 posts / 0 new
Last post
#1 Wed, 05/16/2012 - 04:11

Postfix wrong From address when sending email


I've a problem with emails that are being sent by postfix.

When user.domain (with eamil set as sends an email the, From Address is malformed

the address that appear in From, Return-Path and smtp.mail, is set to: ( where it should be )

when the user receiving the email try to reply , the mail server returns an error because the email does not exists and is not

Recipient address rejected: User unknown in virtual alias table (state 13).

how to fix this issue ?

Wed, 05/16/2012 - 07:01

What exactly is "account" in this case?

Wed, 05/16/2012 - 08:13


In addition to what Locutus asked, which mail client is being used in this case in order to send the emails?



Wed, 05/16/2012 - 10:25

you are right is an issue that only happen when sending from squirrelmail

any idea ?

Wed, 05/16/2012 - 16:44

I repeat: What exactly is "account" in this context? if you want us to help you, you need to answer all our questions.

Thu, 05/17/2012 - 03:31

yes, account is the principal username for managing the domain

domain: account: admin additional user: user1.admin additional user email: (as set up in virtualmin) From address as sent by squirrell:

Thu, 05/17/2012 - 09:12

Hm, I still don't really get it. "admin" is the administrative username for the domain? Where exactly have you used "user1.admin" for that "additional user"? It sounds rather odd to me to name a user like that. And where exactly have you set up "" as email address?

Thu, 05/17/2012 - 10:05

Well, the "user.domain" format is the default used by Virtualmin. That makes Postfix a little happier, but can confuse things like Squirrelmail :-)

I suspect what's happening here is just that Squirrelmail doesn't know how to convert the login name being used to access Squirrelmail into an actual email address.

What you'd likely need to do is just set a From address in Squirrelmail to your actual email address, rather than allowing it to fall back to the default.


Thu, 05/17/2012 - 10:07

Eric, he wrote that Squirrel uses "user1.admin" as username part of the from address, and I'm wondering where the "admin" thing is coming from. Why would the username of the administrative user be part of the email address? I've never seen that.

Thu, 05/17/2012 - 10:19

@ andreychek

Indeed setting the correct name in squirrel solves the issue, thx

@ Locuts

I did not consider the confusion that the term admin can bring, I try to explain

in Virtualmin whenever you create a new account you can set the user name (or call it account name) as you wish , admin will than be the name of the account , the same you see in /home/admin/ folder

in case of an account for a domain such as the account name will be locutus ( in my case admin) all your files will be stored in /home/lucutus (in /home/admin in my case)

if you create a secondary user (user1) , virtaulmin will generate an internal username such as: user1.locutus the email will be

What then squirrel will use as From address (if you dont set it properly in squirrel itself ) will be :

Thu, 05/17/2012 - 17:00

I'm sorry, but I STILL don't understand this issue. It seems to me that you are mixing up "administrative user" and "domain name".

With "create a new account", you mean "create a new domain / virtual server", right? I'm assuming that, since you talk about "creating secondary users" too, which only makes sense in that case.

Virtualmin uses (part of) the domain as home directory name, and not the name of the administrative user. Files for "" with admin "exampleadmin" will be put in "/home/example", and not "/home/exampleadmin". (Except you changed that behavior in the configuration, which I kinda doubt.)

When you create additional users for a domain, I've never seen Virtualmin include the administrative user as part of the new username; why would it do so? And why would it use the administrative username as DOMAIN NAME in the new email address?? This is totally confusing.

Thu, 05/17/2012 - 22:06

Locutus, you may have changed some defaults, which may be adding to the confusion :-)

What he is describing is indeed the default Virtualmin behavior (though, I personally don't use that default on my own system).

On a new server using the Virtualmin defaults, if you create a Virtual Server named "", you would end up with an admin user named "example".

If you then go and create a new email user within that Virtual Server, with an address of, the account name for that user would be "me.example".

So the username is "me.example", and it has an email address of

That behavior can be changed in the Server Templates -- it's in System Settings -> Server Templates -> Default -> Mail for Domain, and in there you can set the format for mail users.

Does that help sort out any of the confusion?


Fri, 05/18/2012 - 03:58

@Eric: Aaah, okay, yes.

On a new server using the Virtualmin defaults, if you create a Virtual Server named "", you would end up with an admin user named "example".

This is the bit I was missing in the chain of logic here. :)

So to sum up: Virtualmin does not add the administrative username to newly created user accounts, but (by default) the first part of the domain name, which happens to be (by default) identical to the admin username.

Yes, indeed then new users would get usernames like "emailuser.firstdomainpart", to which "fulldomain" is added to form "emailuser.firstdomainpart@fulldomain". And indeed Squirrel would have no way of knowing that an "alias" (as per Postfix' virtual domain table) is created to read "emailuser@fulldomain", and would be using the user's login name instead.

And lastly indeed, I also am using a non-default setting here; I have "emailuser@fulldomain" as username for email users, as opposed to "emailuser.firstdomainpart". They use that to log in to Squirrel, and that is also their email address (which Squirrel then correctly derives from the login name).

Topic locked