Sign inSign up

mimedefang/sendmail

By mimedefang

•Updated 3 months ago

MIMEDefang sendmail images

Image
Networking
Security
Integration & delivery
0

638

mimedefang/sendmail repository overview

⁠mimedefang/sendmail

MIMEDefang⁠ email filter running alongside Sendmail as the MTA, maintained by The McGrail Foundation⁠.

MIMEDefang hooks into Sendmail via the Milter protocol and lets you express your mail-filtering policy in Perl — stripping attachments, adding headers, calling SpamAssassin, querying external APIs, and more.


⁠Tags

TagPurpose
latestCurrent stable release – production image (no build tools)
vX.YPinned release, e.g. v3.7
ciCI/CD image – full build toolchain kept

⁠Quick start

docker run -d \
  -e MAIL_DOMAIN=example.com \
  -e MAIL_HOST=mail.example.com \
  -v /path/to/my-filter:/etc/mail/mimedefang-filter:ro \
  -p 25:25 \
  mimedefang/sendmail:latest

If no filter is bind-mounted, a built-in pass-through filter is used so the container starts cleanly out of the box.


⁠Docker Compose (production)

services:
  sendmail:
    image: mimedefang/sendmail:latest
    hostname: mail.example.com
    restart: unless-stopped
    environment:
      MAIL_DOMAIN: "example.com"
      MAIL_HOST:   "mail.example.com"
      TZ:          "Europe/Rome"
    ports:
      - "25:25"
    volumes:
      - ./mimedefang-filter:/etc/mail/mimedefang-filter:ro
      - sendmail-spool:/var/spool/MIMEDefang
      - sendmail-quarantine:/var/spool/MD-Quarantine

volumes:
  sendmail-spool:
  sendmail-quarantine:

⁠Environment variables

All variables have sensible defaults; override only what you need.

⁠Identity
VariableDefaultDescription
MAIL_DOMAINexample.comPrimary mail domain written to local-host-names
MAIL_HOSTmail.example.comFully-qualified hostname (confDOMAIN_NAME)
SMART_HOST(empty)Optional relay/smart host, e.g. [smtp.isp.com]
⁠MIMEDefang multiplexor
VariableDefaultDescription
MIN_WORKERS2Minimum number of Perl worker processes
MAX_WORKERS10Maximum number of Perl worker processes
MAX_IDLE2Workers to keep alive when idle
SPOOL_DIR/var/spool/MIMEDefangMultiplexor and milter socket directory
⁠Sendmail
VariableDefaultDescription
LOG_LEVEL9Sendmail syslog verbosity (confLOG_LEVEL)
SMTP_PORT25SMTP listen port (informational; also set in ports:)
ENABLE_SUBMISSIONnoSet to yes to also listen on port 587 (MSA)
⁠System
VariableDefaultDescription
TZUTCContainer timezone, e.g. Europe/Rome

⁠Volumes

Mount pathPurpose
/etc/mail/mimedefang-filterYour Perl filter — bind-mount required for non-trivial use
/etc/mail/sendmail.mcOptional: full custom sendmail.mc (overrides env-based generation)
/var/spool/MIMEDefangMilter socket + spool — persist to survive container restarts
/var/spool/MD-QuarantineQuarantine directory
/etc/pki/tls/mimedefangTLS certificates (key.pem + cert.pem)

⁠Build-time arguments

When building the image yourself (see GitHub⁠):

ARGDefaultDescription
BASE_IMAGEalmalinux:9Base OS — any RHEL-compatible image works
MIMEDEFANG_VERv3.7Git tag to build from
docker build \
  --build-arg MIMEDEFANG_VER=v3.7 \
  --target prod \
  -t mimedefang/sendmail:v3.7 .

⁠Build targets

# Build the CI image
docker build --target ci -t mimedefang/sendmail:ci .

# Run the test suite
docker compose -f docker-compose-sendmail.yml --profile ci \
  up --build --exit-code-from mimedefang-sendmail-ci

⁠Writing a filter

The filter is a plain Perl file. A minimal example:

use strict;
use warnings;

sub filter_begin  { }
sub filter        { return action_accept(); }
sub filter_end    { }

1;

Mount it at /etc/mail/mimedefang-filter and restart the container. Full documentation: mimedefang-filter(5)⁠ and the examples directory⁠ in the source tree.


Tag summary

Content type

Image

Digest

sha256:ba09b8804…

Size

259.2 MB

Last updated

3 months ago

docker pull mimedefang/sendmail