On the configuration page chose “Internet Site” and continue with the default setting in the next step. Since the whole purpose of our mail server is to just relay all messages to Office365 it is not necessary to configure external domain.
Once installation completes we need to configure postfix; open /etc/postfix/main.cf
sudo nano /etc/postfix/main.cf
For the relayhost add smtp.office365.com and port 587
relayhost = [smtp.office365.com]:587
Since we will be using this mail server locally we want to protect it by saying that we only accept connections from localhost. So modify this two setting:
Our configuration is done. Lets restart postfix and test.
sudo service postfix restart
echo "This is a test body" | mail -s "Relay Test Email" user@publicdomain -a "FROM:email@example.com"
If you did not receive the test email then check the log files at /var/log/mail.log
If you you are trying to send an email from firstname.lastname@example.org to other user in the same @domain.com domain and in the main.cf file for the mydestination setting you have added domain.com then the email will not be sent because postfix thinks this is a local relay. Try removing domain.com from the mydestination setting.