# An SMTP Relay program using Postfix that can receive unencrypted emails and forward them to a modern SMTP server using TLS.
services:
  postfix:
    container_name: postfix
    image: boky/postfix:latest
    environment:
      # Get your linux timezone identifier from https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
      - TZ=Pacific/Auckland
      # Gmails SMTP server
      - RELAYHOST=smtp.gmail.com:587
      # Put in your gmail username
      - RELAYHOST_USERNAME=mygmailusername@mydomain.kiwi
      # You will need an app password. The account must have 2 factor authentication enabled. https://myaccount.google.com/apppasswords
      - RELAYHOST_PASSWORD=hrtc syeb opem gxsn
      # Set your domain here so it is allowed. Remove all domains that you are not sending from.
      - ALLOWED_SENDER_DOMAINS=gmail.com, mydomain.kiwi
      # Make sure your docker container ip is included in the whitelist
      - POSTFIX_mynetworks=172.0.0.0/8, 192.168.1.0/24
    restart: unless-stopped
    ports:
    # The port to send unencrypted SMTP emails to
      - 1587:587
    labels:
      # Stops watchtower from updating this container
      - "com.centurylinklabs.watchtower.enable=false"