https://github.com/chenzhiwei/dockerfile/tree/master/services/postfix
550
A simple SMTP Server build with Postfix + OpenDKIM + SASL authentication support.
Latest doc: https://github.com/chenzhiwei/dockerfile/tree/master/services/postfix
@ in email address.mail.smtp.{DOMAIN}.keysmtp.{DOMAIN}.crt{SELECTOR}.privateDOMAIN=youya.org
SELECTOR=mail
docker run --rm -v $(pwd):/data docker.io/siji/postfix:latest --restrict --bits=2048 --domain=${DOMAIN} --selector=${SELECTOR} --directory=/data
After this command, you will get two files mail.private and mail.txt in your current directory.
mail.txt contains something like mail._domainkey IN TXT ( "v=DKIM1; k=rsa; s=email; "xxx" ), go to your authoritative DNS server provider dashboard(such as cloudflare) to add a TXT record, the key is mail._domainkey and the value is in side the brackets.
mail.private will be used in the create container part.
Suppose your domain is youya.org and you want to host the SMTP server under smtp.youya.org, then you need to apply a certificate with DNS name smtp.youya.org.
Setup SPF record
key: @, value: v=spf1 a:smtp.youya.org ~all, record type TXT
Setup DKIM record
key: mail._domainkey, value: "v=DKIM1; k=rsa; s=email; "<REPLACE WITH YOUR OWN IN mail.txt>", record type TXT
mkdir -p /etc/postfix/secret
cp mail.private /etc/postfix/secret/mail.private
cp smtp.youya.org.key /etc/postfix/secret/smtp.youya.org.key
cp smtp.youya.org.crt /etc/postfix/secret/smtp.youya.org.crt
docker run -d --name postfix -p 587:587 \
-v /etc/postfix/secret:/etc/postfix/secret \
-e DOMAIN=youya.org \
-e USERNAME=your-name \
-e PASSWORD=your-pass \
docker.io/siji/postfix:latest
Create a file named email.txt with following content:
From: [email protected]
To: [email protected]
Subject: an example email
Dear Joe,
Welcome to this example email. What a lovely day.
Send it:
curl -v --ssl --url smtp://smtp.youya.org --mail-from [email protected] --mail-rcpt [email protected] --upload-file email.txt
A few seconds later, you will receive an email with title Authentication Report and it shows your SMTP server result.
Content type
-
Digest
Size
-
Last updated
over 4 years ago
docker pull siji/postfix