Run A MTA (Mail Transfer Agent) for Other Docker Containers
- /etc/systemd/system/EXAMPLE-smtp.service
[Unit] Description=SMTP Proxy for EXAMPLE After=docker.service Requires=docker.service BindsTo=docker.service [Service] SyslogIdentifier=EXAMPLE-smtp.service ExecStart=/usr/bin/systemd-docker run \ --rm \ --name %n \ --net mynet --ip 100.64.5.3 \ --env MAILNAME=git.EXAMPLE.com \ namshi/smtp Restart=always RestartSec=30s Type=notify NotifyAccess=all TimeoutStartSec=120 TimeoutStopSec=30 [Install] WantedBy=multi-user.target
Notes
- Port 25 will be exposed. No authorization is required.
- Modes:
- As SMTP Server
- No extra environment variables
- As Gmail Relay
GMAIL_USER
GMAIL_PASSWORD
- As Amazon SES Relay
SES_USER
SES_PASSWORD
SES_REGION
- As generic SMTP Relay
SMARTHOST_ADDRESS=mail.mysmtp.com
SMARTHOST_PORT=587
SMARTHOST_USER=myuser
SMARTHOST_PASSWORD=secret
SMARTHOST_ALIASES=*.mysmtp.com