Stats Student: > Hi, I would like to configure Postfix to do the following: > > 1) receive messages for users in a Postgres database and hand those > messages to an external script for processing (no traditional > mailstore). The server handles mail for only one domain.
Postfix chooses the delivery method based on the recipient domain (the part on the right-hand side of the '@'). Here, we direct mail for example.com to your message store, and we make sure that all cronjob mail comes from r...@example.com, w...@example.com etc. /etc/postfix/main.cf virtual_transport = mailstore mailstore_destination_recipient_limit=1 virtual_mailbox_domains = example.com virtual_mailbox_maps = hash:/etc/postfix/mailstore-users myorigin = example.com mydestination = /etc/postfix/master.cf: # Requires mailstore_destination_recipient_limit=1 in main.cf. mailstore unix - n n - - pipe flags=DRhu user=vmail argv=/path/to/script ${recipient} /etc/postfix/mailstore-users: f...@example.com whatever b...@example.com whatever Once you have this working, replace hash:/etc/postfix/mailstore-users with a pgsql table that returns a non-emnpty string for existing users, and 'not found' otherwise. See "man pgsql_table", especially the section "LIST MEMBERSHIP". > 2) for a handful of accounts (postmaster, help, root), the messages > should be forwarded to another address (different domain). Would be > great for this forwarding to take place without going through the > processing script in (1). Use virtual_alias_maps: /etc/postfix/main.cf: virtual_alias_maps = hash:/etc/postfix/virtual /etc/postfix/virtual: postmaster user1@example root user2@example help user3@example No need to muck with content filters. Wand ietse