Postfix

Installing a Postfix on a Ubuntu 12.04.

This is just a quick reference for configurations that I use.

References

https://help.ubuntu.com/12.04/serverguide/postfix.html

https://help.ubuntu.com/community/PostfixBasicSetupHowto

https://help.ubuntu.com/community/PostfixVirtualMailBoxClamSmtpHowto

https://help.ubuntu.com/community/Postfix

http://www.postfix.org/

http://www.postfix.org/documentation.html

Install

apt-get install postfix

Basic Configuration (Interactive)

sudo dpkg-reconfigure postfix
sudo postconf -e 'myhostname = xxx.xxx.xx.xxx'

Configurations

Configuration file: /etc/postfix/main.cf

Configuration command (that display or set configuration setting in the configuration file):

sudo postconf parameter 
sudo postconf -e 'parameter = value'

Use Maildir instead of mailbox

sudo postconf -e 'home_mailbox = Maildir/'

sudo postconf -e 'mailbox_command ='

Virtual Hosting

See https://help.ubuntu.com/community/PostfixVirtualMailBoxClamSmtpHowto, tested and it works.

Note (if configured according to the reference):

  • do not list domain in both mydestination in main.cf and virtual domains
  • dovecot (IMAP/POP3) users & passwords at /etc/dovecot/passwd and /etc/dovecot/users
  • postfix virtual hosting domains: /etc/postfix/vhosts (edit manually, no management script)
  • postfix virtual user dir: /etc/postfix/vmaps (need to compile: run "sudo postmap /etc/postfix/vmaps")
  • keep the above files in sync!
  • add user: adddovecotuser (this also adds postfix virtual user, of course)
  • del user: deldovecotuser
  • start / stop / restart postfix: service postfix
  • start / stop / restart dovecot: service dovecot

Administration

Check email queue: mailq