• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 17417
  • Last Modified:

Roundcube webmail and IMAP with GMAIL

Hi,

I would like to know if anyone has successfully used either of these 2 to access GMAIL via IMAP:

Gmail Lite: http://gmail-lite.sourceforge.net/wordpress/
Roundcube: http://roundcube.net/

So far I have come pretty close to accessing gmail via imap using roundcube but I get the following error message:

[13-Nov-2007 18:54:03 -0500] IMAP Error: Could not connect to ssl://imap.gmail.com at port 993: Connection refused in  on line 0
[13-Nov-2007 18:55:04 -0500] IMAP Error: Could not connect to imap.gmail.com at port 993: Connection refused in  on line 0

I've tried connecting using ssl://imap.gmail.com and this imap.gmail.com.

Any assistance would be greatly appreciated.
0
baxleyb
Asked:
baxleyb
  • 9
  • 8
  • 5
1 Solution
 
nizsmoDeveloperCommented:
It should be doable, in theory. the error you are getting means that it is finding the server, but cannot connect due to authentication issues...maybe a password and username is needed?
0
 
darron_chapmanCommented:
I have been successful using RoundMail and GMail... make sure openssl is turned on in.  Here is what the top of my main.inc.php file looks like, you will need to logon using your full email address if you use the following code...

<?php

/*
 +-----------------------------------------------------------------------+
 | Main configuration file                                               |
 |                                                                       |
 | This file is part of the RoundCube Webmail client                     |
 | Copyright (C) 2005-2007, RoundCube Dev. - Switzerland                 |
 | Licensed under the GNU GPL                                            |
 |                                                                       |
 +-----------------------------------------------------------------------+

*/

$rcmail_config = array();


// system error reporting: 1 = log; 2 = report (not implemented yet), 4 = show, 8 = trace
$rcmail_config['debug_level'] = 4;

// enable caching of messages and mailbox data in the local database.
// this is recommended if the IMAP server does not run on the same machine
$rcmail_config['enable_caching'] = TRUE;

// lifetime of message cache
// possible units: s, m, h, d, w
$rcmail_config['message_cache_lifetime'] = '10d';

// automatically create a new RoundCube user when log-in the first time.
// a new user will be created once the IMAP login succeeds.
// set to false if only registered users can use this service
$rcmail_config['auto_create_user'] = TRUE;

// the mail host chosen to perform the log-in
// leave blank to show a textbox at login, give a list of hosts
// to display a pulldown menu or set one host as string.
// To use SSL connection, enter ssl://hostname:993
$rcmail_config['default_host'] = 'ssl://imap.gmail.com:993';

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

// Automatically add this domain to user names for login
// Only for IMAP servers that require full e-mail addresses for login
// Specify an array with 'host' => 'domain' values to support multiple hosts
$rcmail_config['username_domain'] = '';

// This domain will be used to form e-mail addresses of new users
// Specify an array with 'host' => 'domain' values to support multiple hosts
$rcmail_config['mail_domain'] = '';

// Path to a virtuser table file to resolve user names and e-mail addresses
$rcmail_config['virtuser_file'] = '';

// Query to resolve user names and e-mail addresses from the database
// %u will be replaced with the current username for login.
// The query should select the user's e-mail address as first col
$rcmail_config['virtuser_query'] = '';

// use this host for sending mails.
// to use SSL connection, set ssl://smtp.host.com
// if left blank, the PHP mail() function is used
$rcmail_config['smtp_server'] = 'ssl://smtp.gmail.com';

// SMTP port (default is 25; 465 for SSL)
$rcmail_config['smtp_port'] = 465;

// SMTP username (if required) if you use %u as the username RoundCube
// will use the current username for login
$rcmail_config['smtp_user'] = '%u';

// SMTP password (if required) if you use %p as the password RoundCube
// will use the current user's password for login
$rcmail_config['smtp_pass'] = '%p';

// SMTP AUTH type (DIGEST-MD5, CRAM-MD5, LOGIN, PLAIN or empty to use
// best server supported one)
$rcmail_config['smtp_auth_type'] = '';

0
 
baxleybAuthor Commented:
Thanks for the info. I tried modifying my config similar to yours and still get an error.

I believe openssl is enabled based on my php info output:

OpenSSL support       enabled
OpenSSL Version       OpenSSL 0.9.6g 9 Aug 2002

Here is my config:
------------------------------------------------


$rcmail_config = array();


// system error reporting: 1 = log; 2 = report (not implemented yet), 4 = show, 8 = trace
//$rcmail_config['debug_level'] = 1;
$rcmail_config['debug_level'] = 4;

// enable caching of messages and mailbox data in the local database.
// this is recommended if the IMAP server does not run on the same machine
$rcmail_config['enable_caching'] = TRUE;

// lifetime of message cache
// possible units: s, m, h, d, w
$rcmail_config['message_cache_lifetime'] = '10d';

// automatically create a new RoundCube user when log-in the first time.
// a new user will be created once the IMAP login succeeds.
// set to false if only registered users can use this service

$rcmail_config['auto_create_user'] = TRUE;

// the mail host chosen to perform the log-in
// leave blank to show a textbox at login, give a list of hosts
// to display a pulldown menu or set one host as string.
// To use SSL connection, enter ssl://hostname:993
//$rcmail_config['default_host'] = '';

$rcmail_config['default_host'] = 'ssl://imap.gmail.com:993';



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

// Automatically add this domain to user names for login
// Only for IMAP servers that require full e-mail addresses for login
// Specify an array with 'host' => 'domain' values to support multiple hosts
$rcmail_config['username_domain'] = '';

// This domain will be used to form e-mail addresses of new users
// Specify an array with 'host' => 'domain' values to support multiple hosts
$rcmail_config['mail_domain'] = '';

// Path to a virtuser table file to resolve user names and e-mail addresses
$rcmail_config['virtuser_file'] = '';

// Query to resolve user names and e-mail addresses from the database
// %u will be replaced with the current username for login.
// The query should select the user's e-mail address as first col
$rcmail_config['virtuser_query'] = '';

// use this host for sending mails.
// to use SSL connection, set ssl://smtp.host.com
// if left blank, the PHP mail() function is used
$rcmail_config['smtp_server'] = 'ssl://smtp.gmail.com';

// SMTP port (default is 25; 465 for SSL)
$rcmail_config['smtp_port'] = 465;

// SMTP username (if required) if you use %u as the username RoundCube
// will use the current username for login

$rcmail_config['smtp_user'] = '%u';

// SMTP password (if required) if you use %p as the password RoundCube
// will use the current user's password for login

$rcmail_config['smtp_pass'] = '%p';

// SMTP AUTH type (DIGEST-MD5, CRAM-MD5, LOGIN, PLAIN or empty to use
// best server supported one)
//$rcmail_config['smtp_auth_type'] = 'LOGIN';
$rcmail_config['smtp_auth_type'] = '';

// SMTP HELO host
// Hostname to give to the remote server for SMTP 'HELO' or 'EHLO' messages
// Leave this blank and you will get the server variable 'server_name' or
// localhost if that isn't defined.
$rcmail_config['smtp_helo_host'] = '';

// Log sent messages
$rcmail_config['smtp_log'] = TRUE;
------------------------------------------------

Any help would be great, thanks!
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
darron_chapmanCommented:
Have you enabled IMAP in your gmail account?  Also, do you have an IMAP client like Outlook Express or something like that to test and make sure that for some reason you can't get to that port?
0
 
baxleybAuthor Commented:
IMAP is enabled and it works perfect with Outlook Express.
0
 
darron_chapmanCommented:
Are you logging in using your full gmail email account, user@gmail.com, and using the correct password? ...  I'm sure this is a silly question, but after that, I'm out of ideas, except for deleting the RoundCube directory and starting over.
0
 
nizsmoDeveloperCommented:
your error looks like an authentication error, not an error where you cannot connect through to the IMAP server, so either something is wrong with the settings, or your username or password somehow doesn't work. Have you tried another Gmail account and see if that works? remember to enable IMAP on that account.
0
 
baxleybAuthor Commented:
I've tried another gmail account with imap enabled and it is still not working.
I've disabled pop3 and enabled imap in my account and I get this error:

IMAP Error: Could not connect to ssl://imap.gmail.com at port 993: Connection refused

Any ideas?
0
 
nizsmoDeveloperCommented:
// Automatically add this domain to user names for login
// Only for IMAP servers that require full e-mail addresses for login
// Specify an array with 'host' => 'domain' values to support multiple hosts
$rcmail_config['username_domain'] = '';

this looks interesting, have you tried putting your username/email in there?
0
 
baxleybAuthor Commented:
nizsmo: I'll try that out.

darron_chapman: Do you use the .htaccess files included with the install? I don't think that would be the cause but I'm looking at even the most obscure things now.

Thanks to both of you for your help thus far.

0
 
darron_chapmanCommented:
I've never actually even opened that file.  Are you using the latest version of RoundCube?   I decided to go ahead and install RoundCube on another computer with PHP/MySQL on it, and I was able to get it to work again.  What I would recommend is downloading the latest  version of RoundCube from here: http://roundcube.net/downloads and starting over.  Here are the steps I took:

-- Extracted files to directory roundmail in the root of my website
-- created mysql database according to directions in the INSTALL file
-- edited db.inc.php and changed the user id and password to match my mysql username and password
-- edited main.inc.php and ONLY changed this line (for testing purposes) ... $rcmail_config['default_host'] = 'ssl://imap.gmail.com:993';

I was then able to go to http://localhost/roundmail and log in successfully
0
 
darron_chapmanCommented:
Another question:  Are you running your webserver on the same computer you used to test your Gmail account with Outlook Express?
0
 
baxleybAuthor Commented:
nizsmo: I tried that and it didn't work.

darron_chapman: I am using the latest version and it's still not working.

Does anyone know of any other web apps that would work or any other config options in roundcube?
0
 
nizsmoDeveloperCommented:
what about giving squirrelmail a try?
http://www.nabble.com/Gmail-t4696937.html

not sure if it is what you are looking for, but a suggestion to look into.
http://www.squirrelmail.org/
0
 
baxleybAuthor Commented:
I am running squirrelmail with imap for a different email account and it works perfect.

I tried modifying the config in squirrelmail and i get the same error. My site is hosted on 1 and 1 so I am not sure if the issue is related to that specific webhost.
0
 
darron_chapmanCommented:
It almost has to be related to communication problems between 1 and 1 and gmail.  Everything else has been eliminated.
0
 
nizsmoDeveloperCommented:
the final test: try it on another computer elesewhere (different internet connection) and see if it works? if it does then there must be something wrong with your setup.
0
 
darron_chapmanCommented:
I have a domain hosted on 1 and 1, I will load RoundCube on it and report back to you whether or not I get through.
0
 
darron_chapmanCommented:
Yes, it's definitely a communication problem between 1and1 hosted sites and gmail.  I just uploaded RoundCube up to my site ... http://www.lakeridgeintheburg.com/roundcubemail and I get the error you described ... this configuration worked perfectly hosted on my own servers.
0
 
baxleybAuthor Commented:
Whew!

I felt like I was taking crazy pills (zoolander)

Thanks darronchapman for investigating and confirming this issue. I guess I need another host for this purpose or just scracth the idea altogether.

Thanks again.
0
 
darron_chapmanCommented:
You could contact them and see if they're blocking 993 for some reason and see if it can be unblocked.
0
 
baxleybAuthor Commented:
It was great to confirm that the error was related to my web host and not the code or configuration. darronchapman really helped in this effort!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 9
  • 8
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now