A Docker container that can be used for your hobby project to add mail out functionality
524
This container can be used for your hobby project to add mail out functionality. It sets up OpenSMTPD as a simple relay to the configured SMTP server, e.g. Gmail. It will send all emails to the configured mail-to address.
+-------------+ +-----------------+
+-----------------+ | | | |
| | | OpenSMTPd | | external SMTP |
| your container | smtp request | Container | | server, such |
| that needs mail +-----------------> +--------------->+ as Gmail |
| out | to smtp://smtpd+-------------+ | |
| | | name: smtpd | | |
+-----------------+ +-------------+ +-----------------+
+-------------------------------------------------+
| |
| Docker network |
| |
+-------------------------------------------------+
Configuration is done with environment variables. Start the server with the smtpd command. The entrypoint script will do the rest
SMTP_SERVER # Mail server, such as smtp.gmail.com
SMTP_USERNAME # Your SMTP username
SMTP_PASSWORD # Your SMTP password
MAIL_TO # The address all mails should be forwarded to
You can use the docker-compose-example.yml file as a reference, but generally it can be run like this:
docker run --rm -e "SMTP_SERVER=mail.example.com" -e "[email protected]" -e 'SMTP_PASSWORD=mySecretPassword1234' -e "[email protected]" opensmtpd-debian-arm smtpd
Setup an opensmtpd container, create another container and send mail from it, over the internal network`
cp docker-compose-example.yml docker-compose.yml
# Edit docker-compose.yml with you details
docker-compose up -d
docker run --rm -it --net=dockeropensmtpdrelaydebian_default armv7/armhf-debian:jessie /bin/bash
# in container
apt-get update && apt-get -qy install heirloom-mailx
echo "hep" | mailx -v -s "hello from other container" -S smtp=smtp://opensmtpd -S from="whale" [email protected]
MIT, see LICENSE file
Content type
Image
Digest
Size
58.6 MB
Last updated
about 10 years ago
docker pull eripa/opensmtpd-relay-debian