User unknown in virtual alias table

Hello everyone!

I’m using virtualmin/webmin. Did fresh install and everything is ok except mailserver ofc :slight_smile:

I guess I’ve got a problem with postfix. Whenver I try to send mail from outside mail like gmail or local mail from same domain to any of newly created emails I get: User unknown in virtual alias table.

When I’m sending mail from test@example.com to example@example.com I get:

Sep  6 08:17:17 server postfix/error[16827]: 145AD40A40: to=<test.example@example.com>, orig_to=<test@example.com>, relay=none, delay=0, delays=0/0/0/0, dsn=5.0.0, status=bounced (User unknown in virtual alias table)

My setup is following:

Server: CentOS 6.7,
server hostname: server.example.com,
domain I used when creating virtual server: example.com

I also have: mail.example.com which I’m not using anywhere but I can if needed

postfix main.cf:

readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES
virtual_alias_maps = hash:/etc/postfix/virtual
sender_bcc_maps = hash:/etc/postfix/bcc
mailbox_command = /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME
home_mailbox = Maildir/
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination
mailbox_size_limit = 0
allow_percent_hack = no
myorigin = example.com
myhostname = example.com 
mydestination = localhost

/etc/postfix/virtual:

example@example.com      example
example.com    example.com
webmaster@example.com  userxy@gmail.com
hostmaster@example.com userxy@gmail.com
postmaster@example.com userxy@gmail.com
abuse@example.com      userxy@gmail.com
test@example.com       test.example

Tried to google it and made few reinstalls but always the same problem so I’m guessing I’m doing something wrong with hostnames or something I’m missing in configuration?

Any help would be much appreciated!

I sorted it out.

I found old thread on this forum that helped me out a lot: https://www.virtualmin.com/node/8415

Had to change main.cf like this:

myorigin = example.com         #Deleted this
myhostname = example.com   #Changed this into mail.example.com
mydestination = localhost        #Changed this into: $myhostname localhost.$mydomain mail.example.com
mydomain = example.com       #Added this

So ye, it was a problem related to hostname and right config I just didn’t know how to set it up right.

Also I could recommend this page: http://ftp.uma.es/mirror/postfix/doc/postconf.5.html#myhostname for better understanding what is what and what is used for what :). (awesome sentence I know)

Sorry for double thread.