[nflug] Postfix & Virtual DOmains

Tony E - Jaraeth jaraeth at phoenixwing.com
Wed Jul 4 10:37:57 EDT 2007


To add to this, and if you want to experiment a bit, take a look at
Gentoo's guide on building a Postfix/Courier virtual mail system using a
database back end.  I use pretty much this exact setup, with some
customizations, as I run a box that hosts some gaming websites and their
email.

http://gentoo-wiki.com/HOWTO_Setup_a_Virtual_Postfix/Courier_Mail_System_with_PostfixAdmin

Hope that helps too,

  ~ Tony E


Wolfe, Robert wrote:
> I know a lot of you may know this already but I didnt until this morning :)  So, since I found this tidbit of information to be quite useful (since I do email hosting) I thought I would pass this along:
> 
> Date: Wed, 05 Mar 2003 12:11:10 +1100
> From: Tom Ryan tom.ryan at whitehorsestrategic.com
> Subject: RE: multiple domains with postfix
> To: luv at luv.asn.au
> 
> 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 at domain1 or user1 at domain2 it arrive at user1
>>> mailbox.
>> 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 at domain1 might have an account of user1_d1 (or the like) and
>> user1 at domain2 might be user1_d2.
> 
> Incorrect. You need to use virtual domains. Virtual domains take
> 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:
> user at virtual.domain localuser0
> user at other.domain localuser1
> NOTE: do NOT include a line like:
> virtual.domain ANYTHING
> 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)
> 
> NOTES:
> 
> 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 page-----
> user at domain address, address, ...
> Mail for user at domain is redirected to address.
> This form has the highest precedence.
> 
> user address, address, ...
> Mail for user at site is redirected to address when
> site is equal to $myorigin, when site is listed in
> $mydestination, or when it is listed in
> $inet_interfaces.
> 
> This functionality overlaps with functionality of
> the local alias(5) database. The difference is that
> virtual mapping can be applied to non-local
> addresses.
> 
> @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 ;)
> 
> regards,
> tom ryan.
> _______________________________________________
> nflug mailing list
> nflug at nflug.org
> http://www.nflug.org/mailman/listinfo/nflug
> 
> 


More information about the nflug mailing list