How configure roundcube to work with imaps?

I recently installed Postfix, Dovecot to setup a mail server on my own VPS ( using this tutorial: Email with Postfix, Dovecot, Mysql)

Imaps server uses port 993 for Authentication, and Postfix uses port 25 to send mails. In this tutorial, users stored in a Database ( so imaps use mysql to authenticate users). i'm sure every thing works fine with imaps and postfix , because few days ago i installed Kmail client (on my linux) and receive mails from my server. sending mails also works fine, i sent a mail to Gmail and google received it without a problem (in my "Gmail inbox" not spam folder)

So to get to my Emails from a web mail client, i installed Roundcube on /var/www/mail directory.

I configured Roundcube many times. but each time it gives me this Error:

IMAP Error: Login failed for [me@mydomain] from X.x.X.x . Empty startup greeting (localhost:993) in /var/www/mm/program/lib/Roundcube/rcube_imap.php on line 184 (POST /mm/?_task=login?_task=login&_action=login)

When i do log in from roundcube, imap server says ( in /var/log/mail.log ):

May 20 07:05:16 my-server dovecot: imap-login: Disconnected (no auth attempts): rip=::1, lip=::1, TLS handshaking: Disconnected

Here is my roundcube config file :

$config['db_dsnw'] = 'mysql://roundcubeuser:myPassword@localhost/roundcubemail';
// ----------------------------------
// IMAP
// ----------------------------------
$config['debug_level'] = 13;
$config['default_host'] = 'ssl://127.0.0.1';
$config['default_port'] = 993;
// ----------------------------------
// SMTP
// ----------------------------------
$config['smtp_server'] = 'ssl://localhost';

What's the problem? i really have no idea what is happening !

Thank you.


In my config :

$config['default_host'] = 'imaps://domain.tld';

// TCP port used for IMAP connections
$config['default_port'] = 993;

I know that it is not the doc, but it is working. Think about certificate : it should be compliant with your domain.tld


once i have problem with one of my mail servers i use these in dovecot.conf :

auth_verbose=yes
auth_debug=yes
auth_debug_passwords=yes
mail_debug=yes
verbose_ssl=yes
auth_verbose_passwords=plain

then use:

tail -f /var/log/mail.log

you will see everything that is going on behind the scene..