How configure roundcube to work with imaps?

Amin Salami picture Amin Salami · May 20, 2014 · Viewed 21.6k times · Source

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.

Answer

Radu picture Radu · May 23, 2014

I'm using postfix + dovecot + roundcube a few months now and it's working for me. In my configuration, postfix rejects plaintext sessions, so roundcube has to connect with ssl - and it's working.

This is from my main.inc.php. I don't remember editing anything here, it's just the initial config created during the installation.

Now that I'm looking at it, default_port doesn't make any sense, I think it's just ignored.

// To use SSL/TLS connection, enter hostname with prefix ssl:// or tls://
// Supported replacement variables:
// %n - http hostname ($_SERVER['SERVER_NAME'])
// %d - domain (http hostname without the first part)
// %s - domain name after the '@' from e-mail address provided at login screen
// For example %n = mail.domain.tld, %d = domain.tld


// TCP port used for IMAP connections
$rcmail_config['default_port'] = 143;
$rcmail_config['default_host'] = array("ssl://localhost:993");

// TCP port used for IMAP connections
$rcmail_config['default_port'] = 143;