Postfix: Recipient address rejected: User unknown in local recipient table
Solution 1:
I know this question is a little old, so I'm assuming it's been answered satisfactorily already.
I just had this same issue, and it took me a while to figure out what was going on. I think my situation was the same as the original question.
Postfix should relay all mail to other servers on the internet, it does not actually receive mail for any domains. So any mail sent to example.com should be forwarded to the mail server for example.com. The solution, as explained b techieb0y, is to remove $mydomain from the line:
mydestination = $mydomain, localhost.$mydomain, localhost
This line tells postfix that any messages sent to $mydomain are to be received and stored on this server. That's not what I want, I want those messages to be sent to the actual mailserver for example.com. Once I realised this, and removed example.com, mail worked as I expected. I'm posting this on the off chance that this explanation helps somebody else who stumbles upon this question in the future.
Solution 2:
The error is pretty self-descriptive: the target email username (left of the @ sign) can't be mapped to a local user on the system (default postfix settings), nor to a virtual domain (as none are configured out of the box). The decision to try and perform this mapping is controlled by the list of domains in 'mydestination' (plus any virtual domains). If this machine is in fact a domain's primary MX, then users that don't exist have broken mail. If this box only needs to send outgoing messages, simply removing the target domain from mydestination (by removing $mydomain from the list) should suffice -- it will still accept messages directly for [email protected], but messages for [email protected] will go through the MX lookup process for delivery elsewhere. You can shortcut the process by setting up a transport map (for individual domains), or for configuring a smarthost (for all mail).
Solution 3:
When you send a message to your local domain, postfix is responsible for checking that the recipient exists. When you send an email to any other domain, postfix has no such responsibility.
You either need to have a local user called test
useradd -s /bin/bash -d /home/test -U test
or, you need an alias from test to a local user in /etc/aliases
echo "test: root" >> /etc/aliases
postalias /etc/aliases
An you should be all set.
Solution 4:
I had this error when sending e-mails to an alias. Postfix is using /etc/aliases.db which is generated from /etc/aliases by running the following command. This resolved the error:
newaliases