Installation

_$: apt-get install postfix

Configuration

Either during the installation or with _$: dpkg-configure postfix

Configuration style -> Satellite
System mail name -> default.domain.com
SMTP relay host -> mail.domain.com
Root and postmaster mail recipient -> <user>
Other destinations to accept mail for (blank for none): -> Default values
Force synchronous updates on mail queue? -> No
Local networks: -> Default values
Mailbox size limit (bytes): -> 0
Local address extension character: -> +
Internet protocols to use: -> all

Note: Some cloud providers might have troubles if the mail server that relays your email is in the same network than this host and you use the FQDN. Instead, we might need to use the mail server’s internal IP address. For instance, 192.168.1.11.

In order to do the DNS resolution, postfix will use whatever we have in the /etc/resolv.conf file. Anything you write in the /etc/hosts file will be ignored. Instead, we will configure postfix:

/etc/postfix/main.cf:
---------------------
...
relayhost = 192.168.1.11

Check

_$: echo "test" | sendmail <user>@domain.com
_$: echo "test" | mail <user>@domain.com -s "Test"