# POSTFIX: local - virtual transport inteligence



## Seeker (Jan 4, 2012)

Currently, my postfix works, with default *local* transport.
Each created unix user, is a new email account too, i.e:
new_user@mydomain.net

hostname is: fqdn.mydomain.net

Now I've decided that 1 user (new_user), will have additional 3 emails:

one@mydomain.net
two@mydomain.net
three@mydomain.net

and that I'll have to use *virtual* transport for this.



```
virtual_mailbox_maps = hash:/usr/local/etc/postfix/vmailbox

cat /usr/local/etc/postfix/vmailbox
--
one@mydomain.net      /home/[B]new_user[/B]/vMaildirs/one/
two@mydomain.net      /home/[B]new_user[/B]/vMaildirs/two/
three@mydomain.net    /home/[B]new_user[/B]/vMaildirs/three/
--
```

However, I'm getting a local transport error, because you can list mydomain.net EITHER in virtual_mailbox_domains or in mydestination, but not in both!
I have it in mydestination for *local*

How do I make it intelligently figures out when to use local and when virtual delivery transport for same domain name.

And a .... regarding pass:
local is tied to pam
but what should I do with virtual: one@mydomain.net two@mydomain.net three@mydomain.net
All tied to pam of new_user, thus above 3 will have same pass as new_user@mydomain.net OR go a way of non-UNIX account for each virtual.

Finally HOW do I do all this??
Thx in advance.

PS: SPARE me from SQL stuff/connections/ties


----------



## ecazamir (Jan 4, 2012)

Use aliases.
On my configuration, I have an aliases file (see man 5 aliases):

```
# postconf | grep /etc/aliases
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
```
Sample from /etc/aliases (or where your aliases file is):

```
one: new_user
two: new_user
three: new_user
four: user@nonlocaldomain.net
five: root, user@nonlocaldomain.net
```
And then execute /usr/bin/newaliases.

PS: Your example, using LOCAL users, will allow for 'one' to receive mails for all hostnames assigned to that server. for example, if your server has multiple DNS names: x.domain1.tld and y.domain2.tld, then 'one' can be used on any domain, ie: one@x.domain1.tld and one@y.domain2.tld.


----------

