Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save codeprimate/153149 to your computer and use it in GitHub Desktop.
Save codeprimate/153149 to your computer and use it in GitHub Desktop.
groupadd -g 5000 vmail
useradd -g vmail -u 5000 vmail
mkdir -p /var/mail/vhosts/example.com
mkdir -p /var/mail/vhosts/example2.com
chown vmail:vmail /var/mail/vhosts/example.com
chown vmail:vmail /var/mail/vhosts/example2.com
/etc/postfix/main.cf:
virtual_mailbox_domains = example.com, example2.com
virtual_mailbox_base = /var/mail/vhosts
virtual_mailbox_maps = hash:/etc/postfix/vmailbox
virtual_minimum_uid = 100
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
virtual_alias_maps = hash:/etc/postfix/virtual
/etc/postfix/vmailbox:
[email protected] example.com/info/
[email protected] example2.com/sales/
[email protected] example2.com/info/
[email protected] example2.com/sales/
# Comment out the entry below to implement a catch-all.
# @example.com example.com/catchall/
/etc/postfix/virtual:
# to direct virtual account traffic to a real system account
[email protected] postmaster
/etc/courier/authdaemonrc
authmodulelist="authuserdb authpam"
postmap /etc/vmailbox
postmap /etc/virtual
/etc/init.d/postfix restart
/etc/init.d/courier-authdaemon restart
echo "First Post" | mail -s "Welcome" [email protected]
echo "First Post" | mail -s "Welcome" [email protected]
echo "First Post" | mail -s "Welcome" [email protected]
echo "First Post" | mail -s "Welcome" [email protected]
userdb "[email protected]" set uid=vmail gid=vmail home=/var/mail/vhosts/example.com/info mail=/var/mail/vhosts/example.com/info
userdbpw | userdb "[email protected]" set systempw
userdb "[email protected]" set uid=vmail gid=vmail home=/var/mail/vhosts/example.com/sales mail=/var/mail/vhosts/example.com/sales
userdbpw | userdb "[email protected]" set systempw
userdb "[email protected]" set uid=vmail gid=vmail home=/var/mail/vhosts/example2.com/info mail=/var/mail/vhosts/example2.com/info
userdbpw | userdb "[email protected]" set systempw
userdb "[email protected]" set uid=vmail gid=vmail home=/var/mail/vhosts/example2.com/sales mail=/var/mail/vhosts/example2.com/sales
userdbpw | userdb "[email protected]" set systempw
makeuserdb
# For some reason this setup may have problems with IMAP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment