Docker container to forward all incoming mails to a single mailbox
551
run postfix in a Docker container to forward all incoming mails to a single mailbox on the Docker host. Intended for developers of applications that send email to arbitrary addresses.
Pull image
sudo docker pull boomfish/postfix-mailtrap
Create and run a postfix container that maps its mail spool to the host's mail spool
sudo docker run \
-e mynetworks="192.168.1.0/24" -e mailbox_username=alan -e mailbox_uid=1001 \
-v /var/mail:/var/mail --name mailtrap -d boomfish/postfix-mailtrap
Create application containers that link to the mailtrap container for their outgoing SMTP service
sudo docker run -l mailtrap:mailhost -d myapp
When an application container sends email via mailhost, check for it in the specified mailbox (in this case alan) on the Docker host using your favourite mail reader.
This code is available under the MIT License.
This Docker image is built over the docker-postfix image by Elliot Ye. The install.sh script is based largely off the same script from that repository.
Content type
Image
Digest
sha256:d892b0e4a…
Size
97.8 MB
Last updated
almost 11 years ago
docker pull boomfish/postfix-mailtrap