# Any good ebook or  online material about postfix and setting up a virtual mailbox?



## hockey97 (Jan 2, 2012)

Hi, I currently have postfix and dovecot and courier all installed and config. Now the problem is that I get errors saying 
	
	



```
Recipient address rejected: User 
unknown in virtual alias table/code]

I have it set up with mysql but I have no clue why I am getting these errors. Also I can use thunderbird app to login to my e-mail account on my server. Any idea why I get the errors and what I should look at or try? Is there any good material that will educated me as how e-mails travels from and to my server? I can login to my mail account using the mozilla thunderbird and I can send e-mails with no problems. I just can't receive them for one account.

I need to fully understand how e-mails get delivered. Because I plan to allow customers to make their own e-mail account for their own domain name. I be starting a hosting company. So, I need to know what is needed so I can automate the process, where people that have their website hosted on my servers that they can create their own e-mail accounts.
```


----------



## vermaden (Jan 2, 2012)

http://www.amazon.com/Postfix-Defin...2122/ref=sr_1_1?ie=UTF8&qid=1325484179&sr=8-1
http://www.amazon.com/Book-Postfix-...0011/ref=sr_1_2?ie=UTF8&qid=1325484179&sr=8-2

There are also a lot of online HOWTOs on that topic, just type *postfix dovecot howto* into You ${FavoriteSearchProvider}.

Also it's good to enable all possible DEBUG information and track the *postfix/dovecot *log files under /var/log, that helps a lot to track 'configuration bugs'.


----------



## hockey97 (Jan 2, 2012)

vermaden said:
			
		

> http://www.amazon.com/Postfix-Defin...2122/ref=sr_1_1?ie=UTF8&qid=1325484179&sr=8-1
> http://www.amazon.com/Book-Postfix-...0011/ref=sr_1_2?ie=UTF8&qid=1325484179&sr=8-2
> 
> There are also a lot of online HOWTOs on that topic, just type *postfix dovecot howto* into You ${FavoriteSearchProvider}.
> ...



Yes, but I already have it set up. Just having errors which I have no understanding why I am getting them. The error I get is  
	
	



```
Recipient address rejected: User 
unknown in virtual alias table
```
 I can send e-mail outside but when someone replies to that they  get this:


```
Recipient address rejected: User unknown in virtual alias table
```

Here is my postfix main.cf file:

http://pastebin.com/VDi34512

I don't know what would cause the error?

Here is what is in my logs:http://pastebin.com/34Xh8yB2


----------



## amilojko (Jan 2, 2012)

If you have an immediate problem install webmin and look in there, configure it from webmin. 
sysutils/webmin


----------



## hockey97 (Jan 2, 2012)

amilojko said:
			
		

> if you have an immediate problem
> Install webmin and look in there, configure it from webmin
> /usr/ports/sysutils/webmin



Yes, I do have webmin but I still config things manually. I own my own server so I do have root access. I just don't understand what the mysql database tables needs? 
The error seems like the lookup fails. In the error logs it says to not use both domain names in both the virtual aliase and virtual relay domain. Yet, in my mysql database I don't even think I set up a relay domain name.


----------



## vand777 (Jan 2, 2012)

Can you also publish the following files?

/usr/local/etc/postfix/mysql_virtual_alias_maps.cf
/usr/local/etc/postfix/mysql_virtual_domains_maps.cf
/usr/local/etc/postfix/mysql_virtual_mailbox_maps.cf
/usr/local/etc/postfix/mysql_virtual_mailbox_limit_maps.cf
/usr/local/etc/postfix/mysql_relay_domains_maps.cf


----------



## vand777 (Jan 2, 2012)

BTW, I recommend you to look at this guide. It contains approximately 5 or 6 mistakes. If you just follow it, it will not work . However, this is the best HOWTO I've seen and it contains enough information to setup mail server.


----------



## hockey97 (Jan 3, 2012)

vand777 said:
			
		

> Can you also publish the following files?
> 
> /usr/local/etc/postfix/mysql_virtual_alias_maps.cf
> /usr/local/etc/postfix/mysql_virtual_domains_maps.cf
> ...




*Here are the files:*

mysql_relay_domains_maps.cf *:* Click Here

mysql_virtual_domains_maps.cf *:* Click Here

mysql_virtual_mailbox_maps.cf *:* Click Here

mysql_virtual_mailbox_limit_maps.cf *:* Click Here

mysql_virtual_alias_maps.cf *:* Click Here


----------



## vand777 (Jan 4, 2012)

This is what I have:

/usr/local/etc/postfix/mysql_relay_domains_maps.cf:

```
user = postfix
password = your_password
hosts = localhost
dbname = postfix
query = SELECT domain FROM domain WHERE domain='%s' and backupmx = '1'
```

/usr/local/etc/postfix/mysql_virtual_domains_maps.cf:

```
user = postfix
password = your_password
hosts = localhost
dbname = postfix
query = SELECT domain FROM domain WHERE domain='%s' and backupmx = '0' and active = '1'
```

/usr/local/etc/postfix/mysql_virtual_mailbox_maps.cf:

```
user = postfix
password = your_password
hosts = localhost
dbname = postfix
query = SELECT maildir FROM mailbox WHERE username='%s' AND active = '1'
```

/usr/local/etc/postfix/mysql_virtual_mailbox_limit_maps.cf:

```
user = postfix
password = your_password
hosts = localhost
dbname = postfix
query = SELECT quota FROM mailbox WHERE username='%s'
```

My /usr/local/etc/postfix/mysql_relay_domains_maps.cf is the same as yours.


----------



## hockey97 (Jan 5, 2012)

Do I have to have the variable backupmx? I thought that was just there just in case I want to have a backup mail server. It looks like that is the only thing that is different when I compared mine with your SQL files.


----------



## vand777 (Jan 5, 2012)

hockey97 said:
			
		

> Do I have to have the variable [CMD="backupmx"][/CMD]?



Unfortunately, it will not help to solve your problem.


----------



## hockey97 (Jan 9, 2012)

I got a book from the library. Will read it. It's about setting up postfix and there is a section of it that explains how to setup virtual users.

I hope after reading this I would have a good understanding how everything gets routed.


----------



## freecbc3 (Aug 3, 2012)

ty man





			
				vand777 said:
			
		

> This is what I have:
> 
> /usr/local/etc/postfix/mysql_relay_domains_maps.cf:
> 
> ...


----------

