This section gives an example about building a simple virtual hosting configuration with Postfix. Refer to the official documentation for more explanation.

Map files

You first need to create configuration files (or map files) that will be used by Postfix to lookup into Modoboa tables.

To automaticaly generate the requested map files and store them in a directory, run the following command:

> cd <modoboa_instance_path>
> python generate_postfix_maps --destdir <directory>

<directory> is the directory where the files will be stored. Answer the few questions and you’re done.


Use the following configuration in the /etc/postfix/ file (this is just one possible configuration):

# Stuff before
virtual_transport = lmtp:unix:private/dovecot-lmtp

virtual_mailbox_domains = <driver>:/etc/postfix/
virtual_alias_domains = <driver>:/etc/postfix/
virtual_alias_maps = <driver>:/etc/postfix/

relay_domains = <driver>:/etc/postfix/
transport_maps =

smtpd_recipient_restrictions =
      # ...
      # ...

smtpd_sender_login_maps = <driver>:/etc/postfix/

smtpd_sender_restrictions =

# Stuff after

Replace <driver> by the name of the database you use.

Restart Postfix.

Policy daemon

If you want to enable the built-in policy daemon, add the following content to the /etc/postfix/ file:

smtpd_recipient_restrictions =
    # ...
    check_policy_service inet:localhost:9999
    # ...

And reload postfix.


The check_policy_service line must be placed before the permit_mynetworks one, otherwise the daemon won’t be called.