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
will be sent out. Other mails will be catched by MailHog. You can see them on
cat << EOF > /tmp/mail-body.txt From: User Name <email@example.com> To: Example User <firstname.lastname@example.org> Subject: A test email Message body goes here! EOF curl smtp://0.0.0.0:587 \ --mail-from "email@example.com" \ --mail-rcpt "firstname.lastname@example.org" \ -T /tmp/mail-body.txt
You can configure the allowed receiver domains with the environment variable
ALLOWED_RECEIVER_DOMAINS. Separate multiple domains with comma.
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