Getting "Authentication failed" when trying to connect Gmail with docker mailserver

106 views Asked by At

I have configured a mailserver on my web server using docker. I have chosen this one: ghcr.io/docker-mailserver/docker-mailserver

My configuration in docker-compose is:

  mailserver:
    image: ghcr.io/docker-mailserver/docker-mailserver:latest
    container_name: mailserver
    hostname: mail.horairestransports.fr
    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)
      - "110:110"  # POP3
      - "995:995"  # POP3 (with 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/
      - ./letsencrypt:/etc/letsencrypt/
      - /etc/localtime:/etc/localtime:ro
    environment:
      - ENABLE_FAIL2BAN=1
      - SSL_TYPE=letsencrypt
      - PERMIT_DOCKER=network
      - ONE_DIR=1
      - ENABLE_POSTGREY=0
      - ENABLE_CLAMAV=0
      - ENABLE_SPAMASSASSIN=0
      - SPOOF_PROTECTION=0
      - ENABLE_POP3=1
    cap_add:
      - NET_ADMIN
      - SYS_PTRACE
    restart: always

(it is taken from the official docs)

I have no error in the command line, and I am able from my regular mail address to send a mail to my newly created mail "[email protected]". I can see the mail arriving in the logs, and the message in the "/docker-data/dms/mail-data/<DOMAIN_NAME>/contact/new" folder.

The issue is: when trying to connect through gmail, I have an authentication failed error message.

And, in mailserver logs, I have

mailserver    | Dec  4 16:39:25 mail dovecot: auth: passwd-file(contact,192.168.112.1,<o+fRwrEL2pTAqHAB>): unknown user (SHA1 of given password: d2a58f)
mailserver    | Dec  4 16:39:27 mail dovecot: pop3-login: Disconnected: Connection closed (auth failed, 1 attempts in 2 secs): user=<contact>, method=PLAIN, rip=192.168.112.1, lip=192.168.112.3, TLS: Connection closed, session=<o+fRwrEL2pTAqHAB>

I don't really undertand how to solve this. Do you have an idea?

  • I have tried to change ports, and to of course check and replace my password, but nothing changed.

  • I have tried to check the error message, especially the "plaintext" thing, but I am not an expert on this, and as it is said that plaintext activation is not a secure thing to do, so I prefer not to do it and find a reliable solution.

I am expecting: To be able to connect from GMAIL to my mailserver on the POP3 (995) port, in order to see my mails in gmail.

Thank you in advance for your help :)

0

There are 0 answers