Roundcube Community Forum

 

Failed to connect to remote host when trying to save remote IMAP

Started by hukoeth, September 21, 2009, 05:03:23 AM

Previous topic - Next topic

hukoeth

Hi,
I searched the forum but could not find a solution to my problem so I hope someone can hope.
This weekend I switched from a different webmailer to Roundcube and installed the account plugin to connect to different IMAP mailboxes which are all hosted on the same server that also hosts my roundcubce installation.

I have no problem logging in to the IMAP accounts directly but when I try to set up a remote imap account I get the error "Failed to connect to remote host".

I tried using the IMAP_OPEN PHP function to connect to localhost and indeed this fails (although I had a webmailer that uses the PHP IMAP extension).

Does anyone have an idea what else I can try to troubleshoot this?

Thanks,
Uli

rosali

Can setup a test account for me and give me ftp access to roundcube folder? PM'me details ...
Regards,
Rosali

rosali

Thanks to ren1809 - which gave me remote access to his server - the problem could be tracked down. The imap_open failure is related to self-signed certificates (http://bugs.php.net/bug.php?id=20605). We have to use "/novalidate-cert" flag in the "test_connection" part of the plugin.

But I'm not sure if this is a general solution or if I should make it optional.

Can anyone tell me if I may fix it by simply adding the "novalidate-cert" flag or is it likely that the "novalidat-cert" flag cause problems on other environments? I have tested it on my server an remotely on ren1809's server. Both worked fine.


  
function test_connection($username,$password,$imap_host,$imap_port,$prot){
    if(
function_exists("imap_open")){
      
$rcmail rcmail::get_instance();
      
$password $rcmail->decrypt($password);
      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;
  }
Regards,
Rosali

hukoeth

Hi Rosali,
/novalidate-cert works thank you for the quick answer. However it did not fix the problem that I couldn't switch between the accounts (after selecting an account, I was not able to use the dropdown anymore and the account was not switched).
I managed to get this working by changing line 424 from

$rcmail->output->add_footer('<div id=&quot;accounts&quot;>
<a href=&quot;' . $link . '&quot; title=&quot;' . $title .'&quot;>' . $selector . '</a></div>');

to

$rcmail->output->add_footer('

' . $selector . '
');

So everything is working now :) Thanks for this plug-in and your reply.

Cheers,
Uli

rosali

Which browser do you use? Moving the closing tag cause problems in IE6.
Regards,
Rosali