Postfix Backend

This is postfix on the backend imap mail servers. It handles final delivery to user’s maildirs.

codetitle. /etc/postfix/main.cf

myhostname = cormorant.riseup.net
alias_maps = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = cormorant.riseup.net, localhost
mynetworks = 127.0.0.0/8, 10.8.0.0/24

virtual_destination_concurrency_limit = 1
virtual_mailbox_domains = riseup.net
virtual_transport = maildrop
virtual_mailbox_maps =
virtual_alias_maps =

transport_maps = mysql:/etc/postfix/maps/mysql_transport.cf

codetitle. /etc/postfix/maps/mysql_transport.cf

hosts           = 10.8.0.18
dbname          = nest
user            = nest_mail
password        = xxxxxxxx
query = SELECT storage_ip
   FROM mailboxes
   WHERE address = '%s' AND storage_host != 'cormorant.riseup.net'
result_format  =  smtp:[%s]

codetitle. /etc/postfix/master.cf

maildrop  unix  -       n       n       -       -       pipe
  flags=DRhu user=mail argv=/usr/bin/maildrop -d ${recipient}

discussion

the transport map works like this: if the mailbox for the user DOESN’T have a mailbox on this server, then we return the appropriate transport. If the mailbox is on this server, we return nothing, which allows the message to be delivered locally.

the virtual stuff just passes on mail for riseup.net directly to maildrop. aliases should have all be resolved already.