docker-mailserver: Desktop mail client unable to connect to mailserver

Subject

I would like to contribute to the project I would like to configure a not documented mail server use case I would like some feedback concerning a use case I have questions about TLS/SSL/STARTTLS/OpenSSL Other

Description

My desktop mail client (Mozilla Thunderbird) cannot connect to mailserver: “Thunderbird failed to find the settings for your email account”. I have verified that the email account exists using: ./setup.sh -i tvial/docker-mailserver:latest email list. I’m using a bare domain (host name = domain name) - followed these instructions. What’s causing the issue and how can it be resolved?

Screenshot from 2021-05-03 19-14-10

Mailserver output:

.

docker-compose.yml:

version: '2'
services:
  mail:
    image: tvial/docker-mailserver:latest
    hostname: ${HOSTNAME}
    domainname: ${DOMAINNAME}
    container_name: ${CONTAINER_NAME}
    ports:
    - "25:25"
    - "143:143"
    - "587:587"
    - "993:993"
    - "465:465"
    - "995:995"
    - "110:110"
    environment:
    - SSL_TYPE=manual
    - SSL_CERT_PATH=/tmp/ssl/certs/cert.crt
    - SSL_KEY_PATH=/tmp/ssl/private/cert.key
    - ENABLE_POP3=1
    - ENABLE_CLAMAV=0
    - ENABLE_FAIL2BAN=1
    - ENABLE_SPAMASSASSIN=0

    volumes:
    - /etc/ssl:/tmp/ssl:ro
    - maildata:/var/mail
    - mailstate:/var/mail-state
    - maillogs:/var/log/mail
    - ./config/:/tmp/docker-mailserver/
    env_file:
    - .env
    - env-mailserver
    cap_add:
    - NET_ADMIN
    - SYS_PTRACE
    restart: always
volumes:
  maildata:
    driver: local
  mailstate:
    driver: local
  maillogs:
    driver: local

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 33 (16 by maintainers)

Most upvoted comments

Is the MX record for cmore.csir.co.za the only thing that’s outstanding for it to work? What exactly needs to be done to successfully connect on tcp/25?

For receiving emails, a valid MX DNS record is mandatory. Also, at least port tcp/25 must be reachable from the internet (forwarding that port to your VM), which isn’t the case at the moment. If you want to send/receive mails using some client over the internet, you also have to forward the corresponding ports like tcp/995 etc.

The email is live publicly (tried pinging 146.XX.XXX.XXX from an external IP to confirm).

fyi: The IP address is not responding to ICMP ping requests from the internet. At least from the locations I tried. There are plenty of online tools, you can use to verify that. However, ICMP replys are not necessary for a mailserver setup.

You can always refer to our documentation, if you are unsure about certain points:

Is the MX record for cmore.csir.co.za the only thing that’s outstanding for it to work? What exactly needs to be done to successfully connect on tcp/25?

For receiving emails, a valid MX DNS record is mandatory. Also, at least port tcp/25 must be reachable from the internet (forwarding that port to your VM), which isn’t the case at the moment. If you want to send/receive mails using some client over the internet, you also have to forward the corresponding ports like tcp/995 etc.

The email is live publicly (tried pinging 146.XX.XXX.XXX from an external IP to confirm).

fyi: The IP address is not responding to ICMP ping requests from the internet. At least from the locations I tried. There are plenty of online tools, you can use to verify that. However, ICMP replys are not necessary for a mailserver setup.

You can always refer to our documentation, if you are unsure about certain points:

Thanks a lot! Will try to resolve

If it’s running on your local workstation, you can try “localhost” instead of cmore.csir.co.za. But that’s for testing only. You won’t be able to receive any external mails.

Each time I try to log into the email account on Thunderbird I get: “Unable to log in at server …”

I guess you are running the mailserver locally behind your private internet connection? There are no valid MX records for cmore.csir.co.za. Nevertheless I just tried to connect on tcp/25 which failed (most providers block tcp/25, or you don’t have a port forwarding configured on your router.). So I don’t think this is going to work.

That is the problem. The warning is raised, when $SSL_TYPE is not set.

Check your docker-compose.yml for syntax errors and correct indentation. Your lists (e.g. environment) are missing two leading spaces for example.

See https://github.com/docker-mailserver/docker-mailserver/blob/master/docker-compose.yml for comparison.

Not related to your issue 😉

BTW, we should include the image version in the startup output.

Looks like you have not yet updated to the latest image, as @casperklein suggested. Do that first.

fyi:

Your are not using the latest image: image: tvial/docker-mailserver:latest

Correct is image: docker.io/mailserver/docker-mailserver:latest, see also https://github.com/docker-mailserver/docker-mailserver/blob/master/docker-compose.yml

(I masked some IPs inside the logs)

There are multiple issues:

  1. You have specified a key without providing a password. This means that TLS support is disabled and STARTTLS will fail to work. You need to decode the key and use an unencrypted format with this image.
mail    | May  3 16:59:43 cmore postfix/smtps/smtpd[27098]: warning: cannot get RSA private key from file "/etc/postfix/ssl/key": disabling TLS support
mail    | May  3 16:59:43 cmore postfix/smtps/smtpd[27098]: warning: TLS library problem: error:2807106B:UI routines:UI_process:processing error:../crypto/ui/ui_lib.c:545:while reading strings:
mail    | May  3 16:59:43 cmore postfix/smtps/smtpd[27098]: warning: TLS library problem: error:0906406D:PEM routines:PEM_def_callback:problems getting password:../crypto/pem/pem_lib.c:59:
mail    | May  3 16:59:43 cmore postfix/smtps/smtpd[27098]: warning: TLS library problem: error:0907B068:PEM routines:PEM_read_bio_PrivateKey:bad password read:../crypto/pem/pem_pkey.c:64:
mail    | May  3 16:59:43 cmore postfix/smtps/smtpd[27098]: warning: TLS library problem: error:140B0009:SSL routines:SSL_CTX_use_PrivateKey_file:PEM lib:../ssl/ssl_rsa.c:556:
mail    | May  3 16:59:44 cmore postfix/smtps/smtpd[27098]: warning: hostname kyle-VirtualBox does not resolve to address XXX.XXX.XXX.XXX
mail    | May  3 16:59:44 cmore postfix/smtps/smtpd[27098]: connect from unknown[XXX.XXX.XXX.XXX]
mail    | May  3 16:59:44 cmore postfix/smtps/smtpd[27098]: warning: Wrapper-mode request dropped from unknown[XXX.XXX.XXX.XXX] for service smtps. TLS context initialization failed. For details see earlier warnings in your logs.
mail    | May  3 16:59:44 cmore postfix/smtps/smtpd[27098]: disconnect from unknown[XXX.XXX.XXX.XXX] commands=0/0
mail    | May  3 16:59:52 cmore postfix/submission/smtpd[27145]: warning: cannot get RSA private key from file "/etc/postfix/ssl/key": disabling TLS support
mail    | May  3 16:59:52 cmore postfix/submission/smtpd[27145]: warning: TLS library problem: error:2807106B:UI routines:UI_process:processing error:../crypto/ui/ui_lib.c:545:while reading strings:
mail    | May  3 16:59:52 cmore postfix/submission/smtpd[27145]: warning: TLS library problem: error:0906406D:PEM routines:PEM_def_callback:problems getting password:../crypto/pem/pem_lib.c:59:
mail    | May  3 16:59:52 cmore postfix/submission/smtpd[27145]: warning: TLS library problem: error:0907B068:PEM routines:PEM_read_bio_PrivateKey:bad password read:../crypto/pem/pem_pkey.c:64:
mail    | May  3 16:59:52 cmore postfix/submission/smtpd[27145]: warning: TLS library problem: error:140B0009:SSL routines:SSL_CTX_use_PrivateKey_file:PEM lib:../ssl/ssl_rsa.c:556:
  1. Not a dovecot expert, but please check that the user admin@XXX.XXX exists and include the domain as part of the login name, see also: https://github.com/docker-mailserver/docker-mailserver/blob/master/target/dovecot/10-auth.conf#L51 The string “%Lu” means lowercase including domain. See also: https://wiki.dovecot.org/DomainLost

  2. The hostname you are using to connect is not a proper DNS name, tough this is likely a minor issue here as I assume you try to connect via a virtualbox machine. I’m generally suspicious about your network DNS settings, specifically your rDNS name might not be correctly mapped if - and I assume - you are using a desktop system to run this mailserver. Please check this if you want to send mails to external servers. The configured domain also lacks the MX record so you might be less likely to receive external mails (the A record is a viable fallback, but somewhat unusual - also some providers might increase the spam score for sending as well). In general not having proper DNS settings will either put you on external spam lists and/or prevent receiving or sending emails.

mail    | May  3 16:59:44 cmore postfix/smtps/smtpd[27098]: warning: hostname kyle-VirtualBox does not resolve to address XXX.XXX.XXX.XXX
  1. The error message suggests that Mozilla Thunderbird cannot automatically discover your mail settings as you do not fulfill the autodiscover requirements. See also: https://docker-mailserver.github.io/docker-mailserver/edge/config/best-practices/autodiscover/ You can ignore this issue and try to login anyway, but you need to fix the TLS issue in 1 and the likely incorrect name in 2.