Author Topic: Accounts plugin on a NAS  (Read 11370 times)

Offline Simpom

  • Newbie
  • *
  • Posts: 7
Accounts plugin on a NAS
« on: July 06, 2010, 05:08:31 AM »
Hi everyone!

I recently discovered RoundCube and I think it's awesome!
I'm now trying to get access to all my e-mail accounts within one session. I installed the 'sessions' and 'accounts' plugins, everything seems to be ok, but when I try and configure new accounts in 'Account Administration', whatever I can type in the fields, I always get the same error: "Failed to establish connection to remote host.". I tried with several accounts with the same result.

I believe the problem is that RoundCube can't connect to the IMAP server... but on the other hand I can access to my e-mails for the main account (I mean the one I opened a session with)...

Any idea of what to do?

If it can help, I use RoundCube on a Synology NAS (but in a 'stand-alone' installation, I mean not with the pre-installed package; so I can access to each and every part of the setup easily).

Thank you for your help!

Offline rosali

  • Hero Member
  • *****
  • Posts: 2,533
Accounts plugin on a NAS
« Reply #1 on: July 06, 2010, 08:32:59 AM »
This plugins uses PHP imap_open to test if a connection can be established. Roundcube uses socket connections. So either PHP imap module is not available or the imap_open_flag ...

/* imap_open flag (http://php.net/manual/en/function.imap-open.php) */
$rcmail_config['imap_open_flag'] = 'novalidate-cert';

... is misconfigered in the plugin configuration.

As a workaround you could disable the connection test in accounts.php:


  
function test_connection($username,$password,$imap_host,$imap_port,$prot){

add here:

    
return true;

               
    
if(function_exists("imap_open")){
      
$rcmail rcmail::get_instance();
      
$flag $rcmail->config->get('imap_open_flag');
      if(
$flag)
        
$this->imap_open_flag $flag;
      
$password $rcmail->decrypt($password);
      if(
$prot){
        
$imap_open "{" $imap_host ":" $imap_port "/imap/" $prot "/" $this->imap_open_flag "}INBOX";
      }
      else{
        
$imap_open "{" $imap_host ":" $imap_port "/" $this->imap_open_flag "}INBOX";
      }
    
      if(
$res = @imap_open($imap_open$username$password)){
        
$success true;
        
imap_close($res);
      }
      else{
        
$success false;
      }
    }
    else{
      
$success true;
    }
      
    return 
$success;
  
  }



(PHP: imap_open - Manual).
Regards,
Rosali
__________________
MyRoundcube Project (commercial)

Offline Simpom

  • Newbie
  • *
  • Posts: 7
Accounts plugin on a NAS
« Reply #2 on: July 06, 2010, 08:48:48 AM »
Thanks for your reply. But the changes you suggest only allow me to create the account, but not to use it...

I mean that when I create the account, I don't have any error anymore, but when I am in the main page and I click to the account just created, I get disconnected!

Any idea why?
Thx

Offline rosali

  • Hero Member
  • *****
  • Posts: 2,533
Accounts plugin on a NAS
« Reply #3 on: July 06, 2010, 09:04:54 AM »
This happens to any accounts? Is there a difference between local and external accounts (f.e. gmail)?
Regards,
Rosali
__________________
MyRoundcube Project (commercial)

Offline Simpom

  • Newbie
  • *
  • Posts: 7
Accounts plugin on a NAS
« Reply #4 on: July 06, 2010, 09:30:27 AM »
Ok seems to work for gmail! But it definitely does not work with my other accounts (from my internet provider). I tried to connect to a mail box "@sfr.fr" and it does not work...

Is it normal? Any solution to make it work?

Thx

Offline rosali

  • Hero Member
  • *****
  • Posts: 2,533
Accounts plugin on a NAS
« Reply #5 on: July 06, 2010, 10:39:46 AM »
What are your Roundcube imap settings to connect to sfr.fr?
Regards,
Rosali
__________________
MyRoundcube Project (commercial)

Offline Simpom

  • Newbie
  • *
  • Posts: 7
Accounts plugin on a NAS
« Reply #6 on: July 06, 2010, 10:45:45 AM »
I tried "imap.sfr.fr" and "ssl://imap.sfr.fr:993" (but I have no idea if it makes sens or not ;) )
Is that correct?

Offline rosali

  • Hero Member
  • *****
  • Posts: 2,533
Accounts plugin on a NAS
« Reply #7 on: July 06, 2010, 10:49:44 AM »
I don't know the requirements of your ISP. You stated you can connect by Roundcube, so I asked what are the settings in main.inc.php.
Regards,
Rosali
__________________
MyRoundcube Project (commercial)

Offline Simpom

  • Newbie
  • *
  • Posts: 7
Accounts plugin on a NAS
« Reply #8 on: July 06, 2010, 04:17:16 PM »
Well... sth really strange happens!

Let's say I have two email accounts @sfr.fr : email1@sfr.fr and email2@sfr.fr. If I connect to each account, I can send/receive emails from it.
But if I try to configure an account for accessing to the emails of the other, I get disconnected each time I try and change account...
I check twice: my configuration of the host in the plugins/accounts/config/config.inc.php is the same than in the config/main.inc.php

Do you believe there could be a restriction which could prevent me from connecting to multiple accounts at the same time?

Offline rosali

  • Hero Member
  • *****
  • Posts: 2,533
Accounts plugin on a NAS
« Reply #9 on: July 07, 2010, 12:19:58 AM »
Is this your problem? Issue 77 - myroundcube - Accounts plugin: &_mbox=INBOX&_switch=-1 shows an empty page - Project Hosting on Google Code

Do you run Roundcube v0.4beta or recent SVN version?

What is in Roundcube error log?
Regards,
Rosali
__________________
MyRoundcube Project (commercial)

Offline Simpom

  • Newbie
  • *
  • Posts: 7
Accounts plugin on a NAS
« Reply #10 on: July 07, 2010, 03:10:51 AM »
That's not what occurs in my case.

Let's say email2@sfr.fr is configured as an extra email account for email1@sfr.fr.
If I log in with email1@sfr.fr, no problem, I can access my emails. Now if I try to select email2@sfr.fr in the drop down menu (above the folders menu), I am redirected to the connection page.

Concerning the version I'm using, it is the 0.4beta.

Thx for your help.

Offline rosali

  • Hero Member
  • *****
  • Posts: 2,533
Accounts plugin on a NAS
« Reply #11 on: July 07, 2010, 03:58:51 AM »
Is there anything in the Roundcube error logs? You could also enable imap_debug in the Roundcube configuration. Additionally you could check your Imap server logs. Without further informations why the connection is denied I won't be able to help you.
Regards,
Rosali
__________________
MyRoundcube Project (commercial)

Offline Simpom

  • Newbie
  • *
  • Posts: 7
Accounts plugin on a NAS
« Reply #12 on: July 07, 2010, 04:37:45 AM »
SOLVED!!!!

Well I have checked the error log: the problem came from my email server. I'm a bit ashamed :-[ but the email address I was testing was disabled on the server...

But thanks a lot for your help! You made me discover a bit the core of RoundCube.