[plug] postfix help needed

Patrick Coleman blinken at gmail.com
Wed Jan 18 18:32:45 WST 2006


On 17/01/06, Jon  Miller <jlmiller at mmtnetworks.com.au> wrote:
> I need to create a virtual domain to have mail from another domain sent to our mail server.  I also need to setup their mail account on this server.  If I understand the document at ( http://www.postfix.org/VIRTUAL_README.html) in mydestination I put in the domain of the site we're hosting.  How do I go about creating the mailboxes for the users if I want to put the users mailbox say in /var/spool/domain2?
> If I create users isn't their mail in the /var/mail/spool by default?
>
>
> Thanks

To me it seems that the best method is to use virtual mailboxes
without unix accounts. If there is a pressing need to use unix
accounts then you can, but I believe then mail to say
info at original-domain.com is treated the same as mail to
info at new-domain.com. My experience is with virtual mailboxes, so I'll
run through how to setup them. Someone else might have to fill in if
you do want the unix accounts side of things.

For virtual mailboxes, don't put the domain in mydestination - put it
in virtual_mailbox_domains instead.

Set virtual_mailbox_base to the prefix of where you want your virtual
domains delivered to: for example /var/mail if you want mail delivered
to /var/mail/domain1.example.com/mailbox1.

Set virtual_uid_maps to static:<UID>, where <UID> is the user ID of
your mail user. Do the same for virtual_gid_maps, but with the GID of
the mail user. This user needs to own and be able to write to the
mailbox folders. If you like you can create a lookup table here that
maps email addresses to UIDs and another that maps email addresses to
GIDs (use hash:filename instead of static:). This may allow you to use
this virtual mailboxes method with standard system accounts.

The postfix howto also recommends you should set
     virtual_minimum_uid = 100
though it's redundant in this case because we're using static UIDs.
The idea here when using UIDs defined in a lookup table is to stop you
accidentally delivering mail as root or someone equally important and
so do something bad.

You then need to create a lookup table, eg:
virtual_mailbox_maps = hash:/etc/postfix/vmailboxes

This file links email addresses to mailbox locations. Mailbox
locations are relative to virtual_mailbox_base. One mapping per line,
space separated, eg:

# Comments also work like this
info at domain1.example.com   domain1.example.com/mailbox1
test at domain1.example.com   domain1.example.com/test
another_address at domain1.example.com  some/other/location
# You can also implement a catchall:
@domain1.example.com    domain1.example.com/catchall_mailbox

>From memory if the mailbox locations this lookup table returns end in
a / then the mailbox becomes a Maildir-style mailbox (which is
recommended). You will need to create the directory with the command
maildirmake. If no slash is given (as above) then the mailbox is a
standard unix mail file.

You will also need to run `postmap /etc/postfix/vmailboxes` each time
you change the mailbox lookup table. If you use a mysql database
(there are a few tutorials around) then you don't need to run such a
command, which is why I found the option attractive when having to
handle a number of domains.

Anyway, that configuration is essentially what I use (it's basically
pulled off one of the sections of that howto you linked to) and is
what I consider to be the most straight forward and flexible method.
Give it a go and let us know if it works :)

Cheers,
Patrick
--
http://www.labyrinthdata.net.au



More information about the plug mailing list