Public | Automated Build

Last pushed: 4 months ago
Short Description
This Docker image provides a mail transfer agent (MTA) running as a smarthost.
Full Description

imixs/smarthost

This Docker image provides a mail transfer agent (MTA) running as a smarthost for Docker containers. The container can be used to send out e-mails from other containers.

The MTA is based on Exim4. The Image was inspired by the Docker Image from greinacker/exim4.
The Docker image is based on debian:jessie.

Features

  • inherit form debian:jessie
  • provide a minimal MTA Smarthost Configuration

Environment

imixs/smarthost provides the following environment variables

  • EXIM_SMARTHOST - your target mail server
  • EXIM_PASSWORD - authenticating to a remote host as a client.
  • EXIM_ALLOWED_SENDERS - allowed sender IP/Network addresses (default=172.17.0.0/24:127.0.0.1)

1. Install Docker

Follow the Docker installation instructions for your host system.

2. Running and stopping a container

The container can be started in background as an demon. You can start an instance with the command:

docker run --name="smarthost" -d \
-e EXIM_SMARTHOST="target.mail.server.example:25" \
-e EXIM_PASSWORD="target.mail.server.example:login:password" \
imixs/smarthost 

The environment parameter 'EXIM_SMARTHOST' points to the target mail sever used by exim4.
The environment parameter 'EXIM_PASSWORD' is written to the exim4/passwd file. This parameter contains the target mail server, user and login data.

To stop and remove the Docker container run the Docker command:

docker stop smarthost && docker rm smarthost

3. Testing

To follow the exim4 server log:

docker logs -f smarthost

To test your smarthost configuration, first log into the bash of your smarthost:

# log into bash
docker exec -it smarthost /bin/bash    

With the following command you can test sending out an email

echo "This is the message" | mail -s "The subject" captain.kirk@myhost.com -aFrom:sender@myhost.com

Linking the Container

You can link the smarthost Docker container to other containers in your Docker network to allow them to send out mail via the smarthost.

Take care about the default environment setting:

EXIM_ALLOWED_SENDERS=172.17.0.0/24:127.0.0.1

This environment variable defines, if other docker containers running on your docker host, are allowed to use the MTA for sending out e-mails. The default setting is "172.17.0.0/24:127.0.0.1", which allows all linked containers to send mails. Customize this parameter if you have custom needs in your docker virtual network. If the setting is not set correct, you will typically see a log message like

...exim4 IP address .. relay not permitted...

Contribute

The source is available on Github. Please report any issues.

To build the image from the Dockerfile run:

docker build --tag=imixs/smarthost .
Docker Pull Command
Owner
imixs
Source Repository