Roundcube Community Forum
Third Party Contributions => API Based Plugins => Topic started by: doctor madness on December 09, 2009, 04:06:30 AM
-
Hi,
I'd like to use an external IMAP account from roundcube. I enabled accounts (and settings) plugin, I added my server in the list, then I try to create account from "Account administration"
but when I click "Add" button, I get the following error :
"Failed to establish connexion to remote host"
I can connect on port 143 to this host from the server hosting roundcube.
I don't see any error log, what should I do ?
-
Use this test script to check if you are really able to connect from hosting server:
function test_connection($username,$password,$imap_host,$imap_port,$prot){
if(function_exists("imap_open")){
if($prot){
$imap_open = "{" . $imap_host . ":" . $imap_port . "/imap/" . $prot . "/novalidate-cert}INBOX";
}
else{
$imap_open = "{" . $imap_host . ":" . $imap_port . "/novalidate-cert}INBOX";
}
if($res = @imap_open($imap_open, $username, $password)){
$success = true;
imap_close($res);
}
else{
$success = false;
}
}
else{
$success = true;
}
return $success;
}
// DO NOT EDIT
if(test_connection("demo@mail4us.net","demo","mail4us.net",143,false))
echo "mail4us.net ok
";
else
echo "mail4us.net failed
";
//EDIT USER AND PASSWORD
if(test_connection("mygoogleaccount@gmail.com","mygooglepassword","imap.gmail.com",993,"ssl"))
echo "ssl google ok
";
else
echo "ssl google failed
";
?>
-
Hi,
i just tested :
$php5 test.php
the mail4us.net is ok
the gmail is failed
I added my server like this :
if(test_connection("login","password","my.imap.server",143,false))
echo "my_own ok
";
else
echo "my_own failed
";
and my_own imap server is failed too.
It's an IMAP server. I can connect on it using :
telnet my.imap.server 143
Using thunderbird and other MUA is working too
It's php5 from debian stable.
any idea ?
-
no one to help me with this little problem ?
-
Does 'localhost' work for your own IMAP server? Gmail might fail due to missing ssl support of your PHP installation.
-
the test on my locahost is working.
I think it may be related to the remote host. but this hosts is a corporate mail server. where hundreds or thousands people check their mails daily using IMAP (and/or POP)
so I think it should be a bad implementation of IMAP on server side, or php5 imap module
-
Are you able to connect to gmail by configuring main.inc.php to use ssl://imap.gmail.com:993 ?
-
Hi,
I'm not able to connect to gmail. Maybe I need some php modules, to deal with SSL, no ?
-
A lot of hosts block port 993 outbound, I say that's would be the first thing to check.
-
nc -vz imap.gmail.com 993
DNS fwd/rev mismatch: gmail-imap.l.google.com != ew-in-f109.1e100.net
gmail-imap.l.google.com [74.125.77.109] 993 (imaps) open
It seems to be OK. This computer is on a unfiltered network
-
When to try to connect to gmail using RoundCube what shows up in the error log?
-
Hi,
In my errors log file, I don't have anything regarding problem with Gmail.
I really think the problem with Gmail is due to SSL. Maybe a PEAR module is needed, no ?
My original problem is the access to a non SSL IMAP server. I can connect to mail4us.net using code provided by Rosali. But I can't connect to one of mine...
-
Remove "@" sign in front of imap_open command. Perhaps you get some hints by the error message when connection fails.
-
Here are the errors reported when I execute your code without the @ before imap_open :
Warning: imap_open(): Couldn't open stream {imap.gmail.com:993/imap/ssl/novalidate-cert}
-
No idea on this issue ?
-
Do you have OpenSSL?
-
It does not word due to missing SSL support of you PHP installation. That's no Roundcube issue. Please contact your host.
-
I can connect to my remote imap server using telnet, netcat, thunderbird. so I think it's not a problem on my host (i'm the admin of this host) neither network related problem. Maybe my php installation is wrong, but I'm very unskilled in this world. So any help should be very appreciated
-
You can try asking on http://serverfault.com/ you need to install OpenSSL for it to work.
-
Hi,
Thank you for your suggestion, but my remote IMAP server is not using SSL.
-
I finally get it working !
When i tried the code provided by Rosali, and I found I need to replace the "false" in the "$prot" variable with "notls" according to php_imap documentation. Then the test works.
So, I made the following changes in accounts.php :
Line 116 : $imap_open = "{" . $imap_host . ":" . $imap_port . "/imap/" . $prot . "/novalidate-cert}INBOX";
replaced with :
$imap_open = "{" . $imap_host . ":" . $imap_port . "/imap/" . $prot . "/notls}INBOX";
Line 120 : $imap_open = "{" . $imap_host . ":" . $imap_port . "/novalidate-cert}INBOX";
replaced with :
$imap_open = "{" . $imap_host . ":" . $imap_port . "/notls}INBOX";
Line 320 : $prot = FALSE;
replaced with :
$prot = notls;
Line 652 : $prot = FALSE;
Replaced with :
$prot = notls;
And it works !
So, I presume "false" make php_imap uses tls, but my remote IMAP server is nor SSL nor TLS compliant.
I don't have any skill in PHP, but I think a good thing could be to allow user to choose SSL/TLS/Nothing in accounts menu, or to allow RC admin to set this setting in config.php.inc
I contacted ppl developping this plugin to include my correction/suggestions
Regards,
Damien