Solved

Roundcube webmail and IMAP with GMAIL

Posted on 2007-11-13
22
13,438 Views
Last Modified: 2013-11-29
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
Comment
Question by:baxleyb
  • 9
  • 8
  • 5
22 Comments
 
LVL 21

Expert Comment

by:nizsmo
ID: 20276871
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
 
LVL 19

Expert Comment

by:darron_chapman
ID: 20277135
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
 

Author Comment

by:baxleyb
ID: 20277440
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
 
LVL 19

Expert Comment

by:darron_chapman
ID: 20277476
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
 

Author Comment

by:baxleyb
ID: 20277561
IMAP is enabled and it works perfect with Outlook Express.
0
 
LVL 19

Expert Comment

by:darron_chapman
ID: 20277618
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
 
LVL 21

Expert Comment

by:nizsmo
ID: 20278099
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
 

Author Comment

by:baxleyb
ID: 20279309
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
 
LVL 21

Expert Comment

by:nizsmo
ID: 20279322
// 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
 

Author Comment

by:baxleyb
ID: 20279700
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
 
LVL 19

Expert Comment

by:darron_chapman
ID: 20280045
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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 19

Expert Comment

by:darron_chapman
ID: 20280133
Another question:  Are you running your webserver on the same computer you used to test your Gmail account with Outlook Express?
0
 

Author Comment

by:baxleyb
ID: 20285679
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
 
LVL 21

Expert Comment

by:nizsmo
ID: 20286121
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
 

Author Comment

by:baxleyb
ID: 20286287
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
 
LVL 19

Expert Comment

by:darron_chapman
ID: 20286792
It almost has to be related to communication problems between 1 and 1 and gmail.  Everything else has been eliminated.
0
 
LVL 21

Expert Comment

by:nizsmo
ID: 20286899
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
 
LVL 19

Expert Comment

by:darron_chapman
ID: 20288748
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
 
LVL 19

Accepted Solution

by:
darron_chapman earned 500 total points
ID: 20289216
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
 

Author Comment

by:baxleyb
ID: 20290151
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
 
LVL 19

Expert Comment

by:darron_chapman
ID: 20290174
You could contact them and see if they're blocking 993 for some reason and see if it can be unblocked.
0
 

Author Closing Comment

by:baxleyb
ID: 31409131
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

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Follow this checklist to learn more about the 15 things you should never include in an email signature from personal quotes, animated gifs and out-of-date marketing content.
Find out what Office 365 Transport Rules are, how they work and their limitations managing Office 365 signatures.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now