Mail issue: User unknown in virtual alias table

Operating system CentOS Linux 5
Webmin version 1.410
Virtualmin version 3.56 (Pro)

Can’t receive mail as mail sent to any user on the server gets a “User unknown in virtual alias table” error bounce.

Here is an example.

Create a virtual server called example.com
Administration username of admin

Add a mail user named bob

Try to send bob an email at bob@example.com
Get an error

Confirm bob has been added to the /etc/postfix/virtual file
bob@example.com bob.example

This is the error that is logged:
May 19 18:00:56 vps postfix/smtpd[7654]: NOQUEUE: reject: RCPT from wa-out-1112.google.com[209.85.146.177]: 550 5.1.1 <bob.example@example.com>: Recipient address rejected: User unknown in virtual alias table; from=<me@gmail.com> to=<bob.example@example.com> proto=ESMTP helo=<wa-out-1112.google.com>

Then it gets stranger :slight_smile:

If I try to send an email to admin@example.com I get a bounce and this error is logged:
May 19 18:44:24 vps postfix/error[24549]: 1A9DA5A086A4: to=<admin@MyVPSDomain.net>, orig_to=<admin@example.com>, relay=none, delay=0.28, delays=0.23/0.02/0/0.03, dsn=5.0.0, status=bounced (User unknown in virtual alias table)

Confirm admin has been added to the /etc/postfix/virtual file
admin@example.com admin

so it looks like it is trying to map mail for the virtual server’s admin to the wrong domain

MX comes up fine in a DNS lookup:
;; ANSWER SECTION:
example.com. 19249 IN MX 5 mail.example.com.

In Webmin under Network Configuration/Hostname and DNS Client I have my DNS server IP as well as 127.0.0.1

All http and mysql services are working fine.

Of course example.com has been substituted in the info above for the real domain of my virtual server.

What can I do to fix the email issue?<br><br>Post edited by: velvetpixel, at: 2008/05/19 17:11

Oh and here is my postconf output

postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
broken_sasl_auth_clients = yes
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
debug_peer_level = 2
home_mailbox = Maildir/
html_directory = no
mailbox_command = /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
mydestination = $myhostname, localhost.$mydomain, localhost, vps.MyVPSDomain.net
myorigin = $mydomain
newaliases_path = /usr/bin/newaliases.postfix
qmgr_message_active_limit = 4000
readme_directory = /usr/share/doc/postfix-2.3.3/README_FILES
sample_directory = /usr/share/doc/postfix-2.3.3/samples
sender_bcc_maps = hash:/etc/postfix/bcc
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
unknown_local_recipient_reject_code = 550
virtual_alias_maps = hash:/etc/postfix/virtual

OK

I poked around a bit and in Webmin/Postfix/General Options the second field is "What domains to receive mail for"

Mine looked like this:
$myhostname, localhost.$mydomain, localhost, vps.MyVPSDomain.net

I added $mydomain to make it look like this:
$myhostname, localhost.$mydomain, localhost, $mydomain, vps.MyVPSDomain.net

Now mail seems to work fine! :slight_smile:

Before I did that I could not send mail to any user at any of my virtual servers and I also could not check mail in the Webmin Read User Mail module as two of the accounts listed there showed they had mail but when clicked the page listed no mail.

After I added $mydomain I am able to receive mail at all accounts and am able to view old and new mail in the Webmin Read User Mail module.

Is there a way that $mydomain was not added during install? I am on a OpenVZ VPS if that matters.

Is there anything else I should do to make sure that my mail system is functioning properly?

you know mail configuration usually gives me headaches.
I have a centos 5 and default setup. all works fine.
So all i can do is post my postconf -n and per haps this helps a bit.

postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
broken_sasl_auth_clients = yes
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
default_destination_concurrency_limit = 10
home_mailbox = Maildir/
html_directory = no
mailbox_command = /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
maximal_queue_lifetime = 3d
newaliases_path = /usr/bin/newaliases.postfix
readme_directory = /usr/share/doc/postfix-2.3.3/README_FILES
sample_directory = /usr/share/doc/postfix-2.3.3/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated rejec t_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
unknown_local_recipient_reject_code = 550
virtual_alias_maps = hash:/etc/postfix/virtual

Thanks for that!

It helps to be able to compare :slight_smile:

I poked around a bit and in Webmin/Postfix/General Options the second field is "What domains to receive mail for"

This probably isn’t actually the ideal solution. You’ve probably got something set incorrectly in your hostname–do you have a fully qualified domain name? e.g.:

hostname -f

Does it result in a fully qualified domain? And can that name be looked up with host?

host name.from.above

(Where name.from.above should, obviously, be replaced with the name you got back from the hostname -f command.)

Postfix is very sensitive to having a valid fully qualified host name for the system, and this bit of the log:

to=<bob.example@example.com>

Makes it seem likely that your hostname is not correct, according to Postfix.

Oh, wait. I see your problem:

myorigin = $mydomain

You almost certainly DO NOT WANT this option. Get rid of it. It’s not what you think it is, and it doesn’t do what you want it to do.

Thanks for the reply Joe!

Yes my hostname is a FQDN and hostname -f returns the correct hostname and host returns the hostname has address of my server so that part is working fine.

Regarding $mydomain.
When it is not in $myhostname, localhost.$mydomain, localhost, $mydomain, vps.MyVPSDomain.net then my mail is dead.

If I put it back in then mail works fine :frowning:

How do I not get the "User unknown in virtual alias table" error without $mydomain being in that field?

I have the same problem… and its going to be a month old now. Here is my thread:

http://www.virtualmin.com/forums/virtualmin/email-system-seems-not-working-as-preferred..html

But until now…I can’t have it fixed. Hope somebody here with enough knowlegde on postfix functions in virtualhosting environment can enlight us. :frowning:

velvetpixel, you ignored the most important piece of advice, I think. Re-read my message–and look at the directive I told you to get rid of (myorigin). It is the cause of your problem. The other stuff at the beginning was just pointing out that you’re treating the symptoms and not the disease. The disease is myorigin, and you need to unset that variable for mail in a virtual hosting environment to work (or you could set it correctly, but I have no idea how to set it correctly, so let Postfix set it for you–it always gets it right).

xerxeschua, you have the same problem. myorigin should not be set.

Thanks for pointing me in the right direction Joe!
I understood that you meant that myorigin is the issue.

The problem is being a newbie I have no clue on where that variable is set :slight_smile:

It’s not in this string:
$myhostname, localhost.$mydomain, localhost, $mydomain, vps.MyVPSDomain.net

from the Webmin/Postfix/General Options page.

"What domain to use in outbound mail"

This a severely mislabeled option, as that’s not all of (or even at all) what it does.

Also note that every option in the Postfix module has help–click on it and you’ll get a description of what it does. Of course, in this case, the help lies, because it is based on a misunderstanding of the myorigin option, and assumes that you aren’t running a virtual hosting environment–so it is doubly wrong for anyone using Virtualmin.

" “What domain to use in outbound mail”
This a severely mislabeled option, as that’s not all of (or even at all) what it does."

So right now that has the radio button selection set to "Use domainname"

When I click on the question the nice pop up info window appears and says:

What domain to use in outbound mail

myorigin
You specify the domain that appears in mail that is posted on this machine. The default configuration of Postfix is to use the local machine name, hostname.
Unless you are running a really small site, you probably want to change that into domainname, which defaults to the parent domain of the machine name.

(I have been reading the help and info pop-ups and they do help! but some of the things I just don’t understand yet what is the correct entry for my setup. I know I know I am still just a Linux baby)

Ok.

So I am not running a really small site and I am using virtual hosts so what is best for this entry so myorigin is happy?

Do I select hostname? If so does that mean that mail will never be able to appear as though it is coming from a domain and will always look as though it is coming from the host?

Or do I enter something else in the blanck field and select that?

Ok so I tried selecting hostname and it seems to work.

myorigin no longer equals $mydomain :slight_smile:

I still have $mydomain in this string:
$myhostname, localhost.$mydomain, localhost, $mydomain, vps.MyVPSDomain.net
and everything seems to be working as far as mail services.
If this is bad please let me know Joe.

The only thing I have noticed as odd is the Webmin Read User Mail module shows a couple of accounts with mail but when clicking that account there is no mail to read. If I send an email to that account I can then click on that account in Read User Mail and that mail is there and can be read, deleted etc. If I delete it and there are no remaining emails showing in the account then back on the main Read User Mail page that account still shows (10.27 kB in 1). Weirdness :slight_smile:

Mine is still not working. I still get the same error message " User unknown in virtual alias table"

I already changed the settings to #myorigin = /etc/mailname

I removed $mydomain from this string

$myhostname, localhost.$mydomain, localhost, vps.MyVPSDomain.net

And with "What domain to use in outbound mail" set to Hostname my email is working fine.

xerxeschua - Where did you change the myorigin setting? Is your mail still down?

I’m having exactly the same issue as you guys, and despite following the advice given I still get the same error! Here’s a copy of my main.cf:

alias_database = hash:/etc/aliases alias_maps = hash:/etc/aliases broken_sasl_auth_clients = yes command_directory = /usr/sbin config_directory = /etc/postfix daemon_directory = /usr/libexec/postfix default_destination_concurrency_limit = 10 home_mailbox = Maildir/ html_directory = no mailbox_command = /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME mailq_path = /usr/bin/mailq.postfix manpage_directory = /usr/share/man maximal_queue_lifetime = 3d newaliases_path = /usr/bin/newaliases.postfix readme_directory = /usr/share/doc/postfix-2.3.3/README_FILES sample_directory = /usr/share/doc/postfix-2.3.3/samples sendmail_path = /usr/sbin/sendmail.postfix setgid_group = postdrop smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated rejec t_unauth_destination smtpd_sasl_auth_enable = yes smtpd_sasl_security_options = noanonymous unknown_local_recipient_reject_code = 550 virtual_alias_maps = hash:/etc/postfix/virtual mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain, vps.MyVPSDomain.net

Any clues? This is driving me nuts!

Try:
For "What domain to use in outbound mail" set the radio button to Hostname

Change:
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain, vps.MyVPSDomain.net

To:
mydestination = $myhostname, localhost.$mydomain, localhost, vps.MyVPSDomain.net

where vps.MyVPSDomain.net is your actual valid hostname for your system.

mydestination changed, but i’m still getting the same issue. No errors are showing up in the maillog other than “User unknown in virtual alias table”.