Install all all necessary packages:

sudo apt-get install postfix mailutils libsasl2-2 ca-certificates libsasl2-modules

Open your postfix config file:

sudo nano /etc/postfix/

Add the following lines (there might allready be a empty “relayhost” line):

relayhost = []:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_CAfile = /etc/postfix/cacert.pem
smtp_use_tls = yes


sudo nano /etc/postfix/sasl_passwd



Change permission and update postfix config to use sasl_passwd file:

sudo chmod 400 /etc/postfix/sasl_passwd
sudo postmap /etc/postfix/sasl_passwd

Reload postfix config:

sudo /etc/init.d/postfix reload

The following command should send an Email if you have done everything right:

echo "Test" | mail -s "Test"
⤧  Next post Automatic Minecraft server update ⤧  Previous post Let Ubuntu send you Emails if security updates are available