Adam Clarke wrote:
> Theng Ung wrote:
> >I am new to postfix. I manage to get it going with two
> >domains. The problem is though if I send an email to
> >user1@domain1 or user1@domain2 it arrive at user1
> I'm afraid that's how it works. What you need to do is give each user a
> different local account and direct their domain specific mail there.
> So user1@domain1 might have an account of user1_d1 (or the like) and
> user1@domain2 might be user1_d2.
Incorrect. You need to use virtual domains. Virtual domains
precedence over local aliases. Having a local account or alias of the same
name does not interfere with a virtual mapping.
The process is simple. Here is what you need to do:
0. read this whole email before you start ;)
1. main.cf additions
1a. run "postconf -n" and check that there is a line like:
virtual_maps = hash:/etc/postfix/virtual
if not add that line to main.cf
1b. check that all the domains for which you will receive
mail are referenced in $mydestination in main.cf
2. the virtual table
2a. add your virtual aliases to the virtual_maps from main.cf
in your case use this format:
NOTE: do NOT include a line like:
or you will no longer receive mail to local users not
mentioned in the virtual file. If you read up on this
you'll understand why. if you don't... just go along
with me on this one, and it'll work. ;)
3. use the changes
3a. restart postfix:
$ postfix reload
3b. generate the virtual table hash:
$ postmap /etc/postfix/virtual
(or wherever your virtual file is)
the "virtual" equiv of newaliases:
$ postmap /etc/postfix/virtual
run that when you update the virtual table.
here's a more complete look at the ways you can map addresses:
----from the openbsd postfix package's virtual(5) man
user@domain address, address, ...
Mail for user@domain is redirected to address.
This form has the highest precedence.
user address, address, ...
Mail for user@site is redirected to address when
site is equal to $myorigin, when site is listed in
$mydestination, or when it is listed in
This functionality overlaps with functionality of
the local alias(5) database. The difference is that
virtual mapping can be applied to non-local
@domain address, address, ...
Mail for any user in domain is redirected to
address. This form has the lowest precedence.
In all the above forms, when address has the form @other-
domain, the result is the same user in otherdomain. This
works for the first address in the expansion only.
And that's all the postfix that's fit to print ;)
Just wondering if anyone can explain about hosting emails for
domains on the same postfix server. This question may be for people from
ISP system admin background.
e.g., john@domain1, joe@domain1
john@domain2, joe@domain2 ....
This should be simple for a couple domain as we can set up
john@domain1 and john@domain2 go to a particular mailbox. What happen if
there are say 100 domains with similar account?
normally we can access the email for john@domain1 with
john@domain1 and password and for john@domain2 use username john@domain2
Theng Ung(firstname.lastname@example.org)@Thu, Mar 06, 2003 at 11:29:42AM +1100:
> Just wondering if anyone can explain about hosting emails
> differents domains on the same postfix server.
Yeah, do-able. You really have to decide, though, whether you
go for Sendmail-style or Postfix-style.
The former is ideal if you don't care if the address receives
account on the mail server. Sendmail-style is basically a mapping of
email@example.com to xuser@localhost.
Postfix style is preferable where you do not want addresses at
virtual domain to have either local addresses or accounts. Usually in
these cases you'll have to point the MTA at an additional delivery
agent, like a POP3 or IMAP service (e.g. Cyrus, Cucipop, GNUPopper,
Sendmail-style is usually the easiest for people to get a
grasp on and
Details of how to do both are in the Postfix documentation.
than not reading through the commentary in the .cf files, including
those in the samples directory, is enough to get it going.
> This should be simple for a couple domain as we can set
> john@domain1 and john@domain2 go to a particular mailbox. What happen
> if there are say 100 domains with similar account?
Same thing, only larger.
In the case of Sendmail-style you don't have to map:
firstname.lastname@example.org to exactuser@localhost
You could, for example, do something like this:
exactuser_virtual.domain to exactuser_virtual.domain@localhost
Or, if you're concerned about the length of usernames, use
code for each virtual domain. If you're allocating each virtual
domain a different group ID, rather than assigning a generig one, then
you could use that (e.g. map $USER@virtual.domain to
With Postfix-style, since you're not mapping to a local user,
not a concern. The issue with this style of account, of course, is
authentication. Without a local user it can't readily utilise
/etc/passwd and /etc/shadow, thus the need for another authentication
method. Often such methods will be incorporated into the delivery