Docker Office 365 Mail Relay

This article has not been completed yet. However, it may already contain helpful Information and therefore it has been published at this stage.

Setting Up Office 365

Collecting Setup - Informations (Office 365 MX record)

Setting Up the Docker Mail-Relay Container

cd /var/lib/docker/custom_container

mkdir mail-relay

cd mail-relay

nano Dockerfile
FROM ubuntu:latest

RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -q -y postfix rsyslog && \
postconf -e relayhost=<office 365 mx hostname> && \
postconf -e mynetworks="127.0.0.0/8 192.168.0.0/16 10.0.0.0/8 172.16.0.0/12"


EXPOSE 25

CMD ["sh", "-c", "service rsyslog start ; service postfix start ; tail -F /var/log/mail.log"]
docker build . -t "mail-relay"
docker run -d -p 25:25 --restart always mail-relay
docker ps -a

Link: Download Portable SMTP Tester 1.0.1

Sources:

Link

Link 2

Link 3

Link 4