Few links helpful to configure postfix on vps server:
- https://www.hostinger.com/tutorials/how-to-install-and-setup-mail-server-on-ubuntu/ – starting point
- https://www.dmarcanalyzer.com/spf/how-to-create-an-spf-txt-record/ – missing part to not land in SPAM
- https://bobcares.com/blog/postfix-encrypt-email/ – missing default encryption (security level)
- missing DKIM still to add
For docker sending in postfix config we need just set: mynetworks = 172.17.0.0/16, and SMTP host should point to docker0 (172.17.0.1). Setting that will also prevent from sending emails from localhost if not required.