Modern Postfix SMTP server with SASL authentication, TLS & DKIM signing capability. Ubuntu 24.04
440
Modern Postfix SMTP server with SASL authentication, TLS encryption, and DKIM signing support.
docker run -d \
-e maildomain=mail.example.com \
-e smtp_user=user1:pass1 \
-p 25:25 -p 587:587 \
agna/postfix-smtp
maildomain: Server hostnamesmtp_user: User credentials (format: user:pass,user2:pass2)mkdir -p {certs,domainkeys}
openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
-keyout certs/smtp.key -out certs/smtp.crt
opendkim-genkey -D domainkeys/ -d yourdomain.com -s mail
docker run -d \
-e maildomain=mail.yourdomain.com \
-e smtp_user=user1:pass1,user2:pass2 \
-v $PWD/certs:/etc/postfix/certs \
-v $PWD/domainkeys:/etc/opendkim/domainkeys \
-p 25:25 \
-p 587:587 \
agna/postfix-smtp
sudo apt-get install certbot
sudo certbot certonly --standalone -d mail.yourdomain.com
sudo cp /etc/letsencrypt/live/mail.yourdomain.com/fullchain.pem certs/smtp.crt
sudo cp /etc/letsencrypt/live/mail.yourdomain.com/privkey.pem certs/smtp.key
# /etc/cron.d/certbot-renewal
0 0 1 * * root certbot renew --deploy-hook "cp /etc/letsencrypt/live/mail.yourdomain.com/{fullchain.pem,privkey.pem} /path/to/certs/ && docker restart postfix-smtp"
mail._domainkey.yourdomain.com. TXT "v=DKIM1; k=rsa; p=<content of domainkeys/mail.txt>"
yourdomain.com. TXT "v=spf1 ip4:<your-server-ip> -all"
Test SMTP:
telnet localhost 25
Test TLS:
openssl s_client -connect localhost:587 -starttls smtp
Test authentication:
swaks --auth-user user1 --auth-password pass1 \
--server localhost:587 \
--tls \
--to [email protected] \
--from [email protected]
Content type
Image
Digest
sha256:d535788cf…
Size
87.4 MB
Last updated
over 1 year ago
docker pull agna/postfix-smtp