You've already forked docker-smtp
Initial commit
This commit is contained in:
18
Dockerfile
Normal file
18
Dockerfile
Normal file
@@ -0,0 +1,18 @@
|
||||
FROM debian:stretch-slim
|
||||
MAINTAINER Bytemark Hosting "support@bytemark.co.uk"
|
||||
|
||||
# Install exim4
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
RUN set -ex; \
|
||||
apt-get update; \
|
||||
apt-get install -y exim4-daemon-light; \
|
||||
apt-get clean
|
||||
|
||||
# Copy the main script.
|
||||
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
|
||||
|
||||
# We expose exim on port 25.
|
||||
EXPOSE 25/tcp
|
||||
|
||||
ENTRYPOINT [ "docker-entrypoint.sh" ]
|
||||
CMD [ "exim", "-bdf", "-v", "-q30m" ]
|
||||
64
README.md
Normal file
64
README.md
Normal file
@@ -0,0 +1,64 @@
|
||||
# https://github.com/BytemarkHosting/docker-smtp
|
||||
|
||||
## Maintained by: [Bytemark Hosting](https://www.bytemark.co.uk)
|
||||
|
||||
This is the Git repo of the bytemark/smtp image.
|
||||
|
||||
This image allows linked containers to send outgoing email. You can configure
|
||||
it to send email directly to the recipient, or to act as a smart host and relay
|
||||
mail to an intermediate server (eg, GMail, SendGrid).
|
||||
|
||||
## Usage
|
||||
|
||||
In the following examples, linked containers would be able to connect via SMTP
|
||||
to hostname `mail` and port `25` to send outoing email.
|
||||
|
||||
### Basic SMTP server
|
||||
|
||||
In this example, linked containers can connect to hostname `mail` and port `25`
|
||||
to send outgoing email. The SMTP container sends email out directly.
|
||||
|
||||
```
|
||||
docker run --restart always --name mail -d bytemark/smtp
|
||||
```
|
||||
|
||||
Via Docker Compose:
|
||||
|
||||
```
|
||||
mail:
|
||||
image: bytemark/smtp
|
||||
restart: always
|
||||
```
|
||||
|
||||
Optionally, set `MAILNAME` environment variable. (By default, Exim will use the
|
||||
hostname of the container.)
|
||||
|
||||
### SMTP smart host
|
||||
|
||||
In this example, linked containers can connect to hostname `mail` and port `25`
|
||||
to send outgoing email. The SMTP container acts as a smart host and relays mail
|
||||
to an intermediate server server (eg, GMail, SendGrid).
|
||||
|
||||
```
|
||||
docker run --restart always --name mail -d bytemark/smtp \
|
||||
-e RELAY_HOST=smtp.example.com \
|
||||
-e RELAY_PORT=587 \
|
||||
-e RELAY_USERNAME=alice@example.com \
|
||||
-e RELAY_PASSWORD=secretpassword
|
||||
```
|
||||
|
||||
Via Docker Compose:
|
||||
|
||||
```
|
||||
mail:
|
||||
image: bytemark/smtp
|
||||
restart: always
|
||||
environment:
|
||||
RELAY_HOST: smtp.example.com
|
||||
RELAY_PORT: 587
|
||||
RELAY_USERNAME: alice@example.com
|
||||
RELAY_PASSWORD: secretpassword
|
||||
```
|
||||
|
||||
Optionally, set `MAILNAME` environment variable. (By default, Exim will use the
|
||||
hostname of the container.)
|
||||
41
docker-entrypoint.sh
Executable file
41
docker-entrypoint.sh
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
CONFDIR=/etc/exim4
|
||||
|
||||
# Set smarthost.
|
||||
DC_EXIMCONFIG_CONFIGTYPE="internet"
|
||||
if [ "x$RELAY_HOST" != "x" ]; then
|
||||
DC_EXIMCONFIG_CONFIGTYPE="satellite"
|
||||
DC_SMARTHOST="$RELAY_HOST::${RELAY_PORT:-25}"
|
||||
if [ "x$RELAY_USERNAME" != "x" ] && [ "x$RELAY_PASSWORD" != "x" ]; then
|
||||
printf '%s\n' "*:$RELAY_USERNAME:$RELAY_PASSWORD" > "$CONFDIR/passwd.client"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Write exim configuration.
|
||||
cat << EOF > "$CONFDIR/update-exim4.conf.conf"
|
||||
dc_eximconfig_configtype='$DC_EXIMCONFIG_CONFIGTYPE'
|
||||
dc_other_hostnames=''
|
||||
dc_local_interfaces='0.0.0.0'
|
||||
dc_readhost=''
|
||||
dc_relay_domains='*'
|
||||
dc_minimaldns='false'
|
||||
dc_relay_nets='0.0.0.0/0'
|
||||
dc_smarthost='${DC_SMARTHOST:-}'
|
||||
CFILEMODE='644'
|
||||
dc_use_split_config='false'
|
||||
dc_hide_mailname='true'
|
||||
dc_mailname_in_oh='true'
|
||||
dc_localdelivery='mail_spool'
|
||||
EOF
|
||||
|
||||
# Set primary_hostname.
|
||||
if [ "x$MAILNAME" != "x" ]; then
|
||||
printf '%s\n' "$MAILNAME" > /etc/mailname
|
||||
printf '%s\n' "MAIN_HARDCODE_PRIMARY_HOSTNAME=$MAILNAME" >> "$CONFDIR/update-exim4.conf.conf"
|
||||
fi
|
||||
|
||||
# Apply exim configuration.
|
||||
update-exim4.conf
|
||||
|
||||
exec "$@"
|
||||
Reference in New Issue
Block a user