# Postfix: local and virtual users on the same domain?

## loke_71

Hi,

I've set up postfix for virtual mailhosting.

following the Virtual Mailhosting System with Postfix Guide

http://www.gentoo.org/doc/en/virt-mail-howto.xml

Now, I would like to serve both local and virtual users on the same domain, is this possible

The transport table do not accept duplicate domain listings, so is there a way around this?

Thanks

----------

## j-m

This is not possible. But local users can get their mail with virtual transport. But you need to add them to required maps/db/etc... I am using MySQL database for this.

----------

## sf_alpha

It cannot mixed. You should add mail account for local users to database (Virtual Domains). Don't remember to remove domain from mydestination.

----------

## kashani

You've got two choices

1. Add local accounts into mysql.

This will be a pain in the ass since you won't be able to sync passwords between the local accounts and virtual setting. The idea though is that you make an entry in your users table that points mail to the local user say /home/$user/.maildir/ instead of /var/vmail/$domain/$user/.maildir/ As long as you keep everything straight it should work.

2. play the alias game

This is actually a much better solution. We're setting the hostname as a local domain so we can send things that come into the virtual table to local accounts.

```

1   hostname.domain1.com     local:

2   domain1.com              virtual:

3   domain2.com              virtual:

```

Now set some aliases in your virtual table

```

id   email                   destination

1    bob@domain1.com         bob@hostname.domain1.com

2    sid@domain1.com         sid@hostname.domain1.com

2    bob@domain2.com         bob@histname.domain1.com

```

By doing this you can have local users get mail from any virtual domain as long as you add an alias for them. 

kashani

----------

