Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ FROM crazymax/alpine-s6:${ALPINE_VERSION}-2.2.0.3
ENV S6_BEHAVIOUR_IF_STAGE2_FAILS="2" \
TZ="UTC" \
PUID="1500" \
PGID="1500"
PGID="1500" \
LISTEN_PORT="2500"

RUN apk --update --no-cache add \
bash \
Expand All @@ -54,4 +55,4 @@ COPY rootfs /
EXPOSE 2500

HEALTHCHECK --interval=10s --timeout=5s \
CMD printf 'EHLO localhost\r\nQUIT\r\n' | nc -w 2 127.0.0.1 2500 | grep -q '^250' || exit 1
CMD printf 'EHLO localhost\r\nQUIT\r\n' | nc -w 2 127.0.0.1 "$LISTEN_PORT" | grep -q '^250' || exit 1
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ linux/s390x
* `TZ`: Timezone assigned to the container (default `UTC`)
* `PUID`: Daemon user id (default `1500`)
* `PGID`: Daemon group id (default `1500`)
* `LISTEN_PORT`: Container listen port for msmtpd, useful with host, macvlan, or ipvlan networking (default `2500`)
* `SMTP_HOST`: SMTP relay server to send the mail to. **required**
* `SMTP_PORT`: Port that the SMTP relay server listens on. Default `25` or `465` if TLS.
* `SMTP_TLS`: Enable or disable TLS (also known as SSL) for secured connections (`on` or `off`).
Expand Down Expand Up @@ -107,7 +108,7 @@ linux/s390x

## Ports

* `2500`: SMTP relay port
* `2500`: SMTP relay port, configurable through `LISTEN_PORT`

## Usage

Expand Down
2 changes: 1 addition & 1 deletion rootfs/etc/cont-init.d/03-create-service.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ cat > /etc/services.d/msmtpd/run <<EOL
#!/usr/bin/execlineb -P
with-contenv
s6-setuidgid ${PUID}:${PGID}
msmtpd --interface=0.0.0.0 --port=2500 --command="/usr/bin/msmtp -f %F"
msmtpd --interface=0.0.0.0 --port=${LISTEN_PORT} --command="/usr/bin/msmtp -f %F"
EOL
chmod +x /etc/services.d/msmtpd/run
3 changes: 2 additions & 1 deletion test/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ services:
image: ${MSMTPD_IMAGE:-crazymax/msmtpd}
container_name: ${MSMTPD_CONTAINER:-msmtpd}
ports:
- target: 2500
- target: 2525
published: 2500
protocol: tcp
environment:
- "TZ=Europe/Paris"
- "PUID=1500"
- "PGID=1500"
- "LISTEN_PORT=2525"
- "SMTP_HOST=smtp.foo.bar"
restart: always