$ docker-compose up -d
$ wget https://raw.githubusercontent.com/docker-mailserver/docker-mailserver/master/setup.sh
$ chmod a+x ./setup.sh
Run this command to fix: "Recipient address rejected: User unknown in local recipient table"
$ echo "mydestination = localhost.$mydomain, localhost" >> ./docker-data/dms/config/postfix-main.cf
and create domains in /etc/hosts like:
domainxyz.com 127.0.0.1
domainxtp.com 127.0.0.1
-
MX mail [SERVER IP]
-
MX @ [SERVER IP]
-
MX smtp [SERVER IP]
-
A @ [SERVER IP] (if not exists)
-
A webmail [SERVER IP]
-
TXT @ v=spf1 a mx ip4:[SERVER IP] ~all
-
TXT _dmarc v=DMARC1; p=none
server {
listen 80;
server_name webmail.YOURSITE.COM;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://localhost:9002;
}
}
$ certbot --nginx
$ ./setup.sh email add contato@[yourdomain] [your_strong_password]
$ ./setup.sh email add contato@[youranotherdomain] [your_strong_password]
NOTE:
- Dont forget to allow all ports from docker composer file on ufw or another firewall if is enabled
- If you work with multiple domains, you need to repeat steps for dns and hosts configuration for your domains