Postfix wrong mail address

Hi all,

I hope I posted at correct section. I want to ask something about mail address which displayed on "from’ section.

First of all I want to let you know the situation:

  1. I have webmin + virtualmin, everything is working perfect, including mail server. Dovecot receives mails correctly, and postfix sends mails without problem (I use SendGrid relay as my ISP blocking ports 25/465/587)
  2. I have a.com and b.com domains and both of them has users named admin. In this case user for admin@a.com is admin.a.com and admin@b.com is admin.b.com (as I can’t create 2 user with same name)

Now about the problem:
When I send mail from any of these mails, recipient sees mail address in “from” section as admin.a.com@myhostname.localdomain (or admin.b.com@myhostname.localdomain). I know that we can edit main.cf for single domain, but I don’t know what to do in such a situation. So the template is user@localhost.localdomain, but I want it to look like mapped virtual domains as (because even if I can chance localhost.localdomain to real domain name, username is still problem as I want it to show admin@realdomain.com, but not admin.realdomain.com@realdomain.com

Sorry for my bad explanation, I would like to see someone helping about it

Take a look in Webmin -> Servers -> Postfix Mail Server -> Virtual Domains

You should have a couple of entries that look something like

admin@a.com admin.a.com

admin@b.com admin.b.com

along with all the ones that Virtualmin creates (webmaster@c.com, hostmaster@c.com, postmaster@c.com, abuse@c.com)

Hi noisemarine, thanks for reply

The problem is I have them and they are all correct. But I still get wrong names on sent mail

Actually, I think I got your problem backwards in my head. You should probably be looking in Virtualmin -> the domain virtual server -> Edit Users, and check the email address there. I’ve assumed you are talking about mail sent from within Usermin.