Home

Awesome

Postfix Mail Relay

Contains:

Processes are managed by supervisord, including cronjobs

The container provides a simple proxy relay for environments like Amazon VPC where you may have private servers with no Internet connection and therefore with no access to external mail relays (e.g. Amazon SES, SendGrid and others). You need to supply the container with your external mail relay address and credentials. The configuration is tested with Amazon SES.

Exports

Variables

Files

/etc/postfix/sender_canonical : Mount a text file to rewrite sender addresses: e.g., use @local.domain @public.domain.com to rewrite the local domain without altering the user. See documentation for complete usage. /etc/postfix/recipient_canonical : Mount a text file to rewrite recipient addresses: e.g., use @local.domain admin@public.domain.com to redirect local domain mail. See documentation for complete usage.

Example

Launch Postfix container:

$ docker run -d -h relay.example.com --name="mailrelay" -e SMTP_LOGIN=myLogin -e SMTP_PASSWORD=myPassword -v your_sender_canonical:/etc/postfix/sender_canonical -v your_recipient_canonical:/etc/postfix/recipient_canonical -p 25:25 alterrebe/postfix-relay

Running with Docker Compose:

version: "3.4"

services:
  smtp:
    image: alterrebe/postfix-relay
    environment:
      RELAY_HOST_NAME: smtp.example.com
      EXT_RELAY_HOST: "email-smtp.eu-west-1.amazonaws.com"
      EXT_RELAY_PORT: 587
      SMTP_LOGIN: "AKIA*********"
      SMTP_PASSWORD: "*********************************"
      USE_TLS: "yes"
      TLS_VERIFY: "may"
      RAW_CONFIG: |
        # custom config
        always_bcc = bcc@example.com
    volumes:
      - your_sender_canonical:/etc/postfix/sender_canonical
      - your_recipient_canonical:/etc/postfix/recipient_canonical