docker-mailserver: Unable to receive mails

Hello I have configured and installed docker-mailserver the last days. I am now able to send valid e-mails to gmail and other mail services. My problem now is that I cannot receive any. Neither local mails from postmaster@subdomain.domain.com to info@subdomain.domain.com nor from my gmail account to postmaster@subdomain.domain.com. I have disabled spamassassin, fail2ban, postgrey and clamav to ensure that no security mechanism is catching my mails.

I have not registered any aliases, because I don’t need them at the moment.

here is my docker-compose.yml:

version: '2'

services:
  mail:
    image: tvial/docker-mailserver:latest
    hostname: subdomain
    domainname: domain.com
    container_name: mailserver
    ports:
      - "25:25"
      - "143:143"
      - "587:587"
      - "993:993"
      - "465:465"
    volumes:
      - ./data:/var/mail
      - ./state:/var/mail-state
      - /var/log/mail:/var/log/mail
      - ./config/:/tmp/docker-mailserver/
      - /etc/letsencrypt:/etc/letsencrypt
    environment:
      - ENABLE_SPAMASSASSIN=0
      - ENABLE_CLAMAV=0
      - ENABLE_FAIL2BAN=0
      - ENABLE_POSTGREY=0
      - ONE_DIR=1
      - DMS_DEBUG=1
      - PERMIT_DOCKER=connected-networks
      - SPOOF_PROTECTION=1
      - SSL_TYPE=letsencrypt
    cap_add:
      - NET_ADMIN
      - SYS_PTRACE
volumes:
  maildata:
    driver: local
  mailstate:
    driver: local
  maillogs:
    driver: local

What could be the problem here ?

Thx for the help 😃

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 16 (4 by maintainers)

Most upvoted comments

So the last problem was solved… problem was the mydestination definition from postfix. Fixed with adding a postfix-main.cf inside config folder and added mydestination = localhost.$mydomain, localhost instead of mydestination = $myhostname, localhost.$mydomain, localhost

Somewhat simplified there are two types of mail accounts. One is for real users, i.e. users that can login and that have a home directory. The other is for virtual users that can read and send mail, but that should not have accounts on the host. If the host is mail.domain.tld and you define a user as postmaster@mail.domain.tld then that is a local user on that host and the user is assumed to exist and permissions must be in place to allow the mail server to deliver mail to the user’s home directory. If on the other hand you define the user as postmaster@domain.tld then it is a virtual user.

That is one part of the story. The other is that the start_mailserver.sh script makes some assumptions and uses the docker-mailserver specific accounts file for populating several Postfix configuration files. That breaks down and you get warnings when you don’t follow the conventions.

I think you should either follow the conventions, stay close to the defaults and read up on the letsencrypt configuration, or make a deep-dive into Postfix and Dovecot to tweak the configuration the way you want it. Many are using letsencrypt so I very much doubt that your issue is unique. Check the wiki and see if you can adapt one of the working examples. Good luck!

I meant that if you had defined the users, then that warning would be next in line.

My theory is that the problem is caused by confusing subdomain and host. The way you have configured your yaml file the server should have a domain named domain.com and the server itself should have the host name subdomain. If that is what you want then you should define the two accounts as info@domain.com and postmaster@domain.com.

If on the other hand you are really managing mail for subdomain.domain.com then you should probably define the domain to be subdomain.domain.com, the host to be something else (mail?) and then the users are fine as they are. The environment variables in the .env file must be updated as well as the yaml file.