Аутсорсинг ИТ, Web-разработка

Postfix + Maildrop Howto

Postfix + Maildrop Howto


Introduction

This document discusses various options to plug the maildrop delivery agent into Postfix:

Direct delivery without the local delivery agent

Postfix can be configured to deliver mail directly to maildrop, without using the local(8) delivery agent as an intermediate. This means that you do not get local aliases(5) expansion or $HOME/.forward file processing. You would typically do this for hosted domains with recipients that don't have UNIX home directories.

The following example shows how to use maildrop for some.domain and for someother.domain.

 1 /etc/postfix/main.cf:
 2     maildrop_destination_recipient_limit = 1
 3     virtual_mailbox_domains = some.domain someother.domain
 4     virtual_transport = maildrop
 5     virtual_mailbox_maps = hash:/etc/postfix/virtual_mailbox
 6     virtual_alias_maps = hash:/etc/postfix/virtual_alias
 7 
 8 /etc/postfix/virtual_mailbox:
 9     support@ricohprinters.ru        ...text here does not matter...
10     support@ricohprinters.ru        ...text here does not matter...
11     [email protected]   ...text here does not matter...
12 
13 /etc/postfix/virtual_alias:
14     [email protected]           postmaster
15     [email protected]      postmaster

The vmail userid as used below is the user that maildrop should run as. This would be the owner of the virtual mailboxes if they all have the same owner. If maildrop is suid (see maildrop documentation), then maildrop will change to the appropriate owner to deliver the mail.

Note: Do not use the postfix user as the maildrop user.

/etc/postfix/master.cf:
    maildrop  unix  -       n       n       -       -       pipe
      flags=DRhu user=vmail argv=/path/to/maildrop -d ${recipient}

If you want to support [email protected] style addresses, use the following instead:

/etc/postfix/master.cf:
    maildrop  unix  -       n       n       -       -       pipe
      flags=DRhu user=vmail argv=/path/to/maildrop 
      -d ${user}@${nexthop} ${extension} ${recipient} ${user} ${nexthop}

The mail is delivered to ${user}@${nexthop} (match key for maildrop userdb lookup). The ${extension} and the other address components are available to maildrop rules as $1, $2, $3, ... and can be omitted from master.cf or ignored by maildrop when not needed.

Indirect delivery via the local delivery agent

Postfix can be configured to deliver mail to maildrop via the local delivery agent. This is slightly less efficient than the "direct" approach discussed above, but gives you the convenience of local aliases(5) expansion and $HOME/.forward file processing. You would typically use this for domains that are listed in mydestination and that have users with a UNIX system account.

To configure maildrop delivery for all UNIX system accounts:

/etc/postfix/main.cf:
    mailbox_command = /path/to/maildrop -d ${USER}

Note: ${USER} is spelled in upper case.

To enable maildrop delivery for specific users only, you can use the Postfix local(8) delivery agent's mailbox_command_maps feature:

/etc/postfix/main.cf:
    mailbox_command_maps = /etc/postfix/mailbox_commands

/etc/postfix/mailbox_commands:
    you    /path/to/maildrop -d ${USER}

Maildrop delivery for specific users is also possible by invoking it from the user's $HOME/.forward file:

/home/you/.forward:
    "|/path/to/maildrop -d ${USER}"

Credits



© 2004-2006 ООО «ЭЛАНТЕК».
Адрес: Московская область, г. Фрязино, ул. Полевая, д.6, этаж 4, офис 20.
Телефон: +7 (495) 589-68-81, E-mail: support@ricohprinters.ru