Sign inSign up

techdivision/development-postfix

By techdivision

•Updated almost 10 years ago

Postfix image witch sends only to defined domains. All other mails will be catched by MailHog.

Image
0

5.6K

techdivision/development-postfix repository overview

⁠Description

This image is designed for usage in a development environment. It provides a postfix witch deliver mails only to allowed domains. All the other mails will be redirected to the MailHog client which is also running within this image.

⁠Usage / Examples

Start the container with following command and surf http://localhost:8025⁠

docker run \
    -p 587:587 -p 8025:8025 \
    -h postfix.project.dev \
    -e ALLOWED_RECEIVER_DOMAINS=example.com,project.dev \
    techdivision/development-postfix:latest

Send an email e.g. via curl throw the SMTP port 587. Mails witch are sent to example.com will be sent out. Other mails will be catched by MailHog. You can see them on http://localhost:8025⁠

cat << EOF > /tmp/mail-body.txt
From: User Name <[email protected]>
To: Example User <[email protected]>
Subject: A test email

Message body goes here!
EOF

curl smtp://0.0.0.0:587 \
    --mail-from "[email protected]" \
    --mail-rcpt "[email protected]" \
    -T /tmp/mail-body.txt

⁠Configuration

You can configure the allowed receiver domains with the environment variable ALLOWED_RECEIVER_DOMAINS. Separate multiple domains with comma.

⁠docker-compose.yml example

  postfix:
    restart: always
    image: techdivision/development-postfix:latest
    environment:
      ALLOWED_RECEIVER_DOMAINS: example.com,project.dev
    ports:
      - 587:587
      - 8025:8025
    hostname: postfix.project.dev

Tag summary

Content type

Image

Digest

Size

26.3 MB

Last updated

almost 10 years ago

docker pull techdivision/development-postfix