Install and Configure Postfix To Be A Smart Host

  1. Start with a fully updated and configured Ubuntu server.
  2. Install Postfix
    sudo debconf-set-selections <<< "postfix postfix/mailname string `hostname -f`"
    sudo debconf-set-selections <<< "postfix postfix/main_mailer_type string 'Internet Site'"
    sudo apt-get -y install postfix
  3. After installation is complete, type while replacing mydestination and mynetworks with the real values:
    sudo postconf -e 'mydestination = host.example.com'
    sudo postconf -e 'mynetworks = 127.0.0.0/8 [::1]/128 192.168.0.1/32'