Install Postfix

Install postfix and mailutils if not already installed:

sudo apt install postfix mailutils

Postfix Configuration Screen

In the screens, that will show up when installing postfix:

  • General type of mail configuration:

    • Choose Internet Site
  • System mail name:

    • It will be the domain part of our emails, so if you choose the default
    • which is the systems hostname e.g. serverhostname,
    • Postfix will use the address someuser@serverhostname
    • You can use serverhostname.com also.

Configure Postfix to send to Gmail

NEEDS TO BE FILLED

Check Email Sending:

echo "This is test body" | mail -s "testing" youremailaddress@gmail.com

Check for Errors

Check logs

cat /var/log/mail.log
cat /var/log/mail.err
cat /var/log/daemon.log

Check queued emails

mailq

Try resending emails in queue:

sendmail -q

Check postfix status

/etc/init.d/postfix status

Check postfix configuration

postfix check

Open new mail

cat /var/spool/mail/$USER