Exim relay Docker image based on Alpine Linux.
A light weight Docker image for an Exim mail relay, based on the official Alpine image.
For extra security, the container runs as exim not root.
This will allow relay from all private address ranges and will relay directly to the internet receiving mail servers
Smtp Auth (SMTP_PLAINAUTH_USERNAME / SMTP_PLAINAUTH_PASSWORD ) is optional.
docker run \
--name smtp \
--restart always \
-e SMTP_PLAINAUTH_USERNAME= \
-e SMTP_PLAINAUTH_PASSWORD= \
-h my.host.name \
-d \
-p 25:25 \
akit042/exim-smtp
To send forward outgoing email to a smart relay host
docker run \
--restart always \
-h my.host.name \
-d \
-p 25:25 \
-e SMARTHOST=some.relayhost.name \
-e SMTP_USERNAME=someuser \
-e SMTP_PASSWORD=password \
akit042/exim-smtp
version: "2"
services:
smtp:
image: akit042/exim-smtp
restart: always
ports:
- "25:25"
hostname: my.host.name
environment:
- SMARTHOST=some.relayhost.name
- SMTP_USERNAME=someuser
- SMTP_PASSWORD=password
The smarthost password can also be supplied via docker swarm secrets / rancher secrets. Create a secret called SMTP_PASSWORD and don't use the SMTP_PASSWORD environment variable
You may want to persist your mail queue
Just mount your desired path to /var/spool/exim
The logs are sent to /dev/stdout and /dev/stderr and can be viewed via docker logs
docker logs smtp
docker logs -f smtp
Exim commands can be run to check the status of the mail server as well
Print a count of the messages in the queue:
docker exec -it smtp exim -bpc
Print a listing of the messages in the queue (time queued, size, message-id, sender, recipient):
docker exec -it smtp exim -bp
Remove all frozen messages:
docker exec -it smtp exim -bpu | grep frozen | awk {'print $3'} | xargs docker exec -i smtp exim -Mrm
Test how exim will route a given address:
docker exec -it smtp exim -bt [email protected]
[email protected]
router = dnslookup, transport = remote_smtp
host gmail-smtp-in.l.google.com [2a00:1450:400c:c0a::1b] MX=5
host gmail-smtp-in.l.google.com [64.233.167.27] MX=5
host alt1.gmail-smtp-in.l.google.com [2a00:1450:4010:c09::1b] MX=10
host alt1.gmail-smtp-in.l.google.com [173.194.220.27] MX=10
host alt2.gmail-smtp-in.l.google.com [2404:6800:4003:c02::1a] MX=20
host alt2.gmail-smtp-in.l.google.com [74.125.68.27] MX=20
host alt3.gmail-smtp-in.l.google.com [2404:6800:4008:c00::1a] MX=30
host alt3.gmail-smtp-in.l.google.com [108.177.97.27] MX=30
host alt4.gmail-smtp-in.l.google.com [2607:f8b0:400e:c09::1a] MX=40
host alt4.gmail-smtp-in.l.google.com [74.125.195.27] MX=40
Display all of Exim's configuration settings:
docker exec -it smtp exim -bP
View a message's headers:
docker exec -it smtp exim -Mvh <message-id>
View a message's body:
docker exec -it smtp exim -Mvb <message-id>
View a message's logs:
docker exec -it smtp exim -Mar <message-id>
Remove a message from the queue:
docker exec -it smtp exim -Mrm <message-id> [ <message-id> ... ]
Content type
Image
Digest
Size
3.8 MB
Last updated
over 7 years ago
docker pull akit042/exim-smtp