I am trying to set up my own mail server (for 'fun'). I followed this tutorial to the bone. But I get this error message:

imap-login: Disconnected (auth failed, 2 attempts in 9 secs): user=<[email protected]>, method=PLAIN, rip=, lip=, TLS: Disconnected, session=<VDW4ua8NzADL0gcr>

I am using the SSL certificate and key I have for my nginx web server, on the same machine.

I disabled plaintext authentication by adding these two lines (as per tutorial) to /etc/dovecot/conf.d/10-auth.conf:

disable_plaintext_auth = yes
auth_mechanisms = plain login

But the method in the log entry still says PLAIN, and TLS is Disconnected. Could that be an issue?

There're too many configurations to post them all here. if you think you need more information, please tell me which parts and I will update my question.

  • auth failed => your IMAP client provided pair of username and password that doesn't match with your username and password stored in mysql
    – masegaloeh
    Jan 28, 2015 at 9:26
  • @masegaloeh I double-, triple-checked my password and username and they are correct. There are so many places where it can go wrong - wrong encryption, missed parameters...I think I will just start again >_<
    – dayuloli
    Jan 28, 2015 at 16:35

2 Answers 2


Make sure your mail client forces using TLS.

To debug you could also try to comment the disable_plaintext_auth option out. Always reload/restart postfix or dovecot when changing something.

  • How do I 'force' the client to use TLS? I am trying to connect to it using my phone, and I tried both SSL and TLS and it didn't work. I will try doing it again from scratch and checking after each step...even though that will taken me much longer!
    – dayuloli
    Jan 28, 2015 at 16:34
  • Which client do you use? Mostly there is an connection option where you can choose SSL/TLS.
    – sme
    Jan 29, 2015 at 15:28
  • I just use the one provided by my native Android phone. It let's me select something like 'SSL', 'SSL (Accept all certificates), 'TLS', 'TLS (Accept all certificates)'. And I tried them all already...Now I have reverted back to my old externally hosted mail server...since I was being a cowboy and losing email. I have decided now to host the mail server on its own machine and use a 'dummy' domain to test and make sure everything works
    – dayuloli
    Jan 29, 2015 at 15:32

It's several years on, so this answer will likely be of no use to you. BUT for future readers here's an approach to take.

Enable maximum debug for the Dovecot authentication layer, bearing in mind that this means passwords will be written to the log file in the clear.

You are looking to identify which of these possible scenarios applies in this situation:

  • Username/password mismatch
  • TLS required by server but not agreed by client (or v.v.)
  • Client offering an authentication scheme that's unsupported by your server
  • Communication issue between Dovecot and MySQL
  • Something else

Specifically, check that auth_mechanisms and disable_plaintext_auth are correct. Enable auth_verbose and/or auth_debug, and temporarily auth_verbose_passwords, and possibly auth_debug_passwords. On my older Debian system these are all in 10-logging.conf.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .