how to configure multiple IMAP/SMTP domain adresses ? #2596
-
Hello, I have docker-mailserver behind a reverse proxy, configured with a virtual host and a secondary domain, let's say This is my docker compose config: version: "3.3"
services:
mailserver:
image: docker.io/mailserver/docker-mailserver:latest
container_name: mailserver
# If the FQDN for your mail-server is only two labels (eg: example.com),
# you can assign this entirely to `hostname` and remove `domainname`.
hostname: mail
domainname: domain.com
# env_file: mailserver.env
# More information about the mail-server ports:
# https://docker-mailserver.github.io/docker-mailserver/edge/config/security/understanding-the-ports/
# To avoid conflicts with yaml base-60 float, DO NOT remove the quotation marks.
ports:
- "25:25" # SMTP (explicit TLS => STARTTLS)
- "143:143" # IMAP4 (explicit TLS => STARTTLS)
- "465:465" # ESMTP (implicit TLS)
- "587:587" # ESMTP (explicit TLS => STARTTLS)
- "993:993" # IMAP4 (implicit TLS)
volumes:
- ./docker-data/dms/mail-data/:/var/mail/
- ./docker-data/dms/mail-state/:/var/mail-state/
- ./docker-data/dms/mail-logs/:/var/log/mail/
- ./docker-data/dms/config/:/tmp/docker-mailserver/
- ./docker-data/certbot/certs/:/etc/letsencrypt
- /etc/localtime:/etc/localtime:ro
restart: unless-stopped
stop_grace_period: 1m
environment:
- SSL_TYPE=letsencrypt
- VIRTUAL_HOST=mail.domain.com
- LETSENCRYPT_HOST=mail.domain.com
- ENABLE_SPAMASSASSIN=1
- SPAMASSASSIN_SPAM_TO_INBOX=1
- ENABLE_CLAMAV=1
- ENABLE_FAIL2BAN=1
- ENABLE_POSTGREY=1
- ENABLE_SASLAUTHD=0
- ONE_DIR=1
- DOMAINS=mail.secondary.com
cap_add:
- NET_ADMIN
- SYS_PTRACE
networks:
- server
nginx-proxy-lorenzano:
image: nginx
container_name: nginx-proxy-secondary
environment:
- VIRTUAL_HOST=mail.secondary.com
- LETSENCRYPT_HOST=mail.secondary.com
networks:
- server
networks:
server:
external: true Any help is welcome :) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Assuming your reverse-proxy supports the IMAP and SMTP protocols (not just HTTP/S), then you should be able to get that working correctly at least. I'm not able to assist you there as it's not something I've personally setup before for this project. The other part with additional domains is also not something I understand well enough to advise further. My understanding is that For example, you could have The mail server will send from the same IP address and should have a reverse DNS (rDNS) lookup for that IP to the mail server FQDN (eg: Hopefully that clears things up a bit better? You mail clients for IMAP (and submitting mail to send via SMTP, or rather ports 465 or 587) would connect to That should work AFAIK, but your reverse proxy must properly be configured to support those protocols, this is not usually as well supported out of the box and may require some extra configuration. I've seen users configure Traefik for this in our Github Issues, you could try reference that. |
Beta Was this translation helpful? Give feedback.
Assuming your reverse-proxy supports the IMAP and SMTP protocols (not just HTTP/S), then you should be able to get that working correctly at least. I'm not able to assist you there as it's not something I've personally setup before for this project.
The other part with additional domains is also not something I understand well enough to advise further. My understanding is that
docker-mailserver
can be configured to support multiple domains, but is primarily configured as the MX mail server domain.For example, you could have
mail.example.com
that doesn't handle email for[email protected]
, but does for[email protected]
and[email protected]
. So try to think of it this way as a separate s…