What's this?
A very minimal Postfix image for Docker with relay support. It provides outbound SMTP only, to get mails out of Docker. The image is optimized for size (< 10MB) and simplicity.
Usage
Start Postfix standalone (to send emails from containers)
$ docker run --rm --name=postfix \
-e MTP_HOST=foo.com \
dnknth/alpine-postfix
Or use a remote relay server:
$ docker run --rm --name=postfix \
-e MTP_HOST=foo.com \
-e MTP_RELAY=smtp.gmail.com \
-e MTP_USER=foo \
-e MTP_PASS=secret \
dnknth/alpine-postfix
Send emails:
$ docker exec -it postfix mail foo@bar.com
Supported environment variables
MTP_HOST
: Themyhostname
parameter specifies the internet hostname of this mail system (localhost)MTP_DESTINATION
: Themydestination
parameter specifies the list of domains that this machine considers itself the final destination for.MTP_BANNER
: Thesmtpd_banner
parameter specifies the text that follows the 220 code in the SMTP server's greeting banner.MTP_RELAY
: Therelayhost
parameter specifies the default host to send mail to when no entry is matched in the optional transport(5) table.MTP_RELAY_DOMAINS
: Therelay_domains
parameter restricts what destinations this system will relay mail to.MTP_PORT
: Therelayhost
portMTP_USER
: The user used to connect to therelayhost
MTP_PASS
: The password used to connect to therelayhost
MTP_INTERFACES
: Theinet_interfaces
parameter specifies the network interface addresses that this mail system receives mail on.