From ◜◝◟◞◜◝◟◞◜◝◟◞◜◝◟◞◜◝◟◞◜◝◟◞◜◝◟◞
Jump to: navigation, search

Set up MX and A records in your DNS settings first. Create an A record with the texts mail and ip address for the fields. Create an MX record with your specified and 5 for the priority field. Wait 48 hours for this to propograte.


sudo apt-get update
sudo apt-get install postfix mailutils libsasl2-2 libsasl2-modules sasl2-bin

Edit emacs /etc/default/saslauthd file and set START=yes

If you need to reconfigure an installed Postfix, use: dpkg-reconfigure postfix

sudo emacs /etc/postfix/
myhostname =
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

append_dot_mydomain = no
readme_directory = no

smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination

alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
virtual_alias_domains =
virtual_alias_maps = hash:/etc/postfix/virtual
myorigin = /etc/mailname
mydestination =,, localhost
mynetworks = [::ffff:]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all

relayhost =
smtpd_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtpd_sasl_security_options = noanonymous
smtp_sasl_tls_security_options = noanonymous
broken_sasl_auth_clients = yes
virtual & mailname

Create a file, emacs /etc/postfix/virtual and add

Create another file with emacs /etc/mailname and add


emacs /etc/postfix/sasl_passwd and add the following:


Set permissions to:

chmod 600 /etc/postfix/sasl_passwd*
chown -R postfix:postfix /etc/postfix/.

Update the Configuration

Rebuild the "hash" then restart Postfix.

sudo postmap /etc/postfix/virtual
sudo service postfix restart


  • Check with the postconf command that the domain aliases and alias file have been setup properly: postconf -n | grep virtual[1]
  • Check the postfix status: sudo service postfix status
  • Check that it is running on port 25 with Netstat: sudo netstat -ltnp | grep 25[2]
  • Verify DNS settings of the domain. It's necessary to ensure that the MX records for your domain are pointing to the right server. Use a dig command to do so: dig mx
  • Error logs: /var/log/mail.log
  • Use to send an email.