Roundcube login via PHP script

Posted in Programming on May 16th, 2008 by Philipp C. Heckel – 83 Comments

Roundcube is an AJAX/PHP based e-mail application which is really flexible and easy to use in comparison to other free web based solutions.

For the customer interface of Silversun, I wanted to use RC as the internal web mail application and therefore had to embed it into my system. To avoid that the customer has to log in twice (customer interface and Roundcube), I had to simulate the login request with a PHP script.

Updates

November 2008: After the comment of Matias, I reviewed the code and fixed some issues. Now it should work properly even with the newest Roundcube version (0.2-beta). The class file itself contains installation instructions. Please read them carefully.

March 2009: Just tested the script with version 0.2.1 and it works like a charm, at least for my installation.

December 2009: Diego just confirmed (via e-mail) that the script also works for 0.3.1 without modification.

May 2010: I just tested the scripts with Roundcube 0.4-beta, and it still works without modification. I also added the section Debugging make it easier to figure out what’s wrong.

March 2011: After Alex’ comment, I adjusted a small part of the script. It should now also work with Roundcube 0.5.1. It now handles the new request token correctly. The pre-0.5.1 script is still available for download here: RoundcubeLogin.pre-0.5.1.class.php.

April 2012: I have updated the script again. It now works with 0.7.2. Issues were PHP’s multiple-cookie handling, the sessauth-cookie as well as the user agent checks by RC. The pre-0.6 version is still available for download here: RoundcubeLogin.pre-0.6.class.php.

Prepare RC

To perform the Roundcube login via a web site, it is necessary to turn off the check_ip/ip_check option in the main.inc.php file, because our script (= server IP address) will send the login data and pass it to RC instead of the user’s browser (= user IP address).

The RoundcubeLogin class

This small class only consists of four functions and it shouldn’t be necessary to modify it in order to get the login to work.

The class provides four public methods:

  • login($username, $password)
    Perform a login to the Roundcube mail system.
    Note: If the client is already logged in, the script will re-login the user (logout/login). To prevent this behaviour, use the isLoggedIn()-function.
    Returns: TRUE if the login suceeds, FALSE if the user/pass-combination is wrong
    Throws: May throw a RoundcubeLoginException if Roundcube sends an unexpected answer (that might happen if a new Roundcube version behaves differently)
  • isLoggedIn()
    Checks whether the client/browser is logged in and has a valid Roundcube session.
    Returns: TRUE if the user is logged in, FALSE otherwise.
    Throws: May also throw a RoundcubeLoginException (see above).
  • logout()
    Performs a logout on the current Roundcube session.
    Returns: TRUE if the logout was a success, FALSE otherwise.
    Throws: May also throw a RoundcubeLoginException (see above).
  • redirect()
    Simply redirects to Roundcube.

Sample usage

The script below demonstrates how the class can be used. If the client is already logged in, it simply redirects the browser to the Roundcube application. If not, it performs a login and then redirects to Roundcube.

<?php
 
include "RoundcubeLogin.class.php";	
 
# Create RC login object.
# Note: The first parameter is the URL-path of the RC inst.,
#       NOT the file-system path
# e.g. http://host.com/path/to/roundcube/ --> "/path/to/roundcube"
$rcl = new RoundcubeLogin("/roundcube/", $debug);
 
try {
   # If we are already logged in, simply redirect
   if ($rcl->isLoggedIn())
      $rcl->redirect();
 
   # If not, try to login and simply redirect on success
   $rcl->login("some-email-address", "plain-text-password");
 
   if ($rcl->isLoggedIn())
      $rcl->redirect();
 
   # If the login fails, display an error message
   die("ERROR: Login failed due to a wrong user/pass combination.");
}
catch (RoundcubeLoginException $ex) {
   echo "ERROR: Technical problem, ".$ex->getMessage();
   $rcl->dumpDebugStack(); exit;
}
 
?>

Debugging

If you’re having problems with the RoundcubeLogin.class.php class itself, try using the rclogin.php-file for debugging: open the file in your browser (http://myhost/roundcube/rclogin.php), and take a look at the output. The RoundcubeLogin-class performs a series of request/response cycles and parses the output to figure out if you’re logged in.

Known issues:

  1. No Roundcube installation found at ‘…’
    This error message is thrown if the path-value in the RoundcubeLogin constructur was not set correctly. It must be set to the part of the URL that represents the path, e.g. in case of http://myhost/roundcube/ you must create the object like this:

    $rcl = new RoundcubeLogin("/roundcube/");
  2. Unable to determine login-status due to technical problems.
    This error can occur in the methods login(), logout() and isLoggedIn(). The RoundcubeLogin-class expects Roundcube to send certain headers in response to the login/logout-requests. If those headers could not be found, this error is thrown. Possible reasons are:

    • New RC version
    • Cookies must be enabled
    • ip_check/check_ip option in the main.inc.php must be false
  3. Unable to determine the login status. Unable to continue due to technical problems.
    This error occurs if the script cannot determine if you are logged in or not, because the returned HTML code neither contains the login-form (= logged out) nor the message DIV (= logged in). This might happen if Roundcube changed the HTML-code.

I’m open for suggestions

Please feel free to post your comment or suggestions. That’s the only way to ensure that it works with all versions.

  1. matias says:

    hey! thanks for sharing…I couldn’t make it work, I get errors on this lines:
    header($line); (line 89 of the class)
    and:
    header(“Location: /mypath/rc”);

    the success var contains a 1, so I guess the login works fine.

    If in a different tab of my browser try to go to “mydomain/mypath/rc/?_task=mail”, I get redirected to the rc login page.
    Wasn’t I suposed to see my mails if I get a 1 at the success line?

    can you tell me what version of roundcube are you using? mine is 0.1.1

    thank you very much!!

  2. Philipp says:

    Hallo Matias,

    thanks for your comment. I will look into this at the weekend.
    In fact, i’ve experienced some difficulties after my update too, — so
    this might me the chance for me to fix this bug and answer your questions.

    Regards,
    Philipp

  3. Philipp says:

    Hey everyone,

    I just updated the script and the blog post.
    It should now work like a charm.

    Philipp

  4. matias says:

    Philipp….thank you very much!!!!!
    It worked perfectly!!!
    good job!
    again, thank you a lot

    regards
    matias

  5. Simone says:

    Hi, I receive the message error:

    Status: ERROR: Unable to determine the login status. Unable to continue due to technical problems.

    I’m using RC 0.2b version.
    I’ve modified the main.inc.php file setting $rcmail_config['ip_check'] = false;

    The classic login works.

    Any suggestions?

    Thanks!

  6. Philipp says:

    Hey Simone,

    if you give me the debug output, I can take a look. I’m gonna write you a mail so that we can try to fix it …

    Regards,
    Philipp

    Update 30th Nov:
    Unfortunately, Simone didn’t reply to my mail. Therefore, I can’t help her …

  7. uzu says:

    hi,

    i havent test it fully right now… but i got some errors and could fix it.

    first .. local .. all right ..runs smoothly :D

    public .. errors .. first “no roundcube install found” .. change it to ‘./roundcubemail/’ .. then i got the error Status: ERROR: Unable to determine the login status. Unable to continue due to technical problems.

    then i change followed:
    private function sendRequest($path, $postData = false) {
    $method = (!$postData) ? “GET” : “POST”;
    $port = ($_SERVER['HTTPS']) ? 443 : 80;
    $host = ($port == 443) ? “ssl://email.godz-clan.org” : “email.godz-clan.org”;

    my webspace provider block maybe localhost .. dont know .. but so it runs.

    maybe you make a variable host so you can make this at one place if someone has the same error.

  8. joris says:

    Philipp,

    Thanks for this workaround. I am looking for a solution to login from an external page into RC. Your soluation seems to be perfect for what i am looking for.

    After i tried the code, the error

    “Status: ERROR: Unable to determine the login status. Unable to continue due to technical problems.”

    popped up. As far as i can see, all my parameters are set up as they should. Even the original login page in RC works as it should. I even tried UZU’s solution (above).

    I use RC version: RELEASE 0.2-ALPHA.
    PHP 5, etc..

    Thanks in advance.

    Joris

  9. Nick says:

    Philipp..

    Really cool workaround, thank you so much for posting it..

    But it doesn’t seem to be working for me!

    Here’s the error I get:

    Warning: Cannot modify header information – headers already sent by (output started at …/roundcubelogin.class.php:398) in …/roundcubelogin.class.php on line 351

    Warning: Cannot modify header information – headers already sent by (output started at …/roundcubelogin.class.php:398) in …/roundcubelogin.class.php on line 351

    Warning: Cannot modify header information – headers already sent by (output started at …/roundcubelogin.class.php:398) in …/roundcubelogin.class.php on line 233

    any ideas?

  10. Philipp says:

    @Nick: Sure. Simply remove all spaces before “< ?php" and after "?>” in the
    class-file :-)

  11. Jack says:

    Philipp,

    I desperately want to use your solution. However, I keep getting an error that I’m not sure how to fix.

    First of all, I have to set the first argument of the RoundcubeLogin class constructor to “./roundcube/” instead of “/roundcube/” or I get the message “ERROR: Technical problem, No Roundcube installation found at ‘/roundcube/’.”

    After that, I get the message “ERROR: Technical problem, Unable to determine the login status. Unable to continue due to technical problems.” The debug output is saying that it is a 400 Bad Request error. I can see that it is caused by trying to append “./roundcube” to my domain name rather than resolving to the correct directory path. For example, instead of correctly making the request to http://mydomain.com/path/to/roundcube, it’s trying to make the request to http://mydomain.com./roundcube.

    Will you please help me get this working?

    TIA,
    Jack

  12. Philipp says:

    @Jack: This looks pretty simple. You should be using the correct path in the constructor.

    Instead of

    $rcl = new RoundcubeLogin(“/roundcube/”, true);

    write

    $rcl = new RoundcubeLogin(“/path/to/roundcube/”, true);

    This parameter is the URL-path of your roundcube installation. That is, if your RC is installed at http://mydomain.com/path/to/roundcube/, you should specify “/path/to/roundcube/” as webmail-path.

    Regards, Philipp

  13. carl says:

    Thanks!

    I have this working, and it meets 100% of my needs but…

    I can only get it to work with a clear text password!

    Is there any way to make this work with an encrypted password?

    It would be a big security issue for my site to store clear text passwords…

    Thanks!

  14. Philipp says:

    Hey there,

    you don’t have to store the clear text passwords in your database. That’s absolutely not necessary.

    The easiest way is to store the clear text password in the $_SESSION variable when the user logs in. That is, the password is only stored temporarily on the server and can only be stolen when someone is able to steal the session AND your script prints the password at some point. However, due to the fact that you don’t have to print the password, but only send it to the RC installation, this shouldn’t be a problem….

    Regards,
    Philipp

  15. Steve says:

    First, thank you for creating this script and for your continued support of it!

    Have you tested this with RC 2.2? The script doesn’t seem to be working for me – I get an error that the roundcube installation isn’t found.

    I have tried /roundcube/ and http://www.idatasys.net/roundcube/ – neither seems to work.

  16. Philipp says:

    Hey Steve,

    I haven’t had the chance to test it unfortunately and I will not be able to do so for the next month (since I am traveling around in California, yey!!).

    It is possible that RC 2.2 either completely changed the login mechanisms, or some parts of the HTML output (which my script uses to parse the results).

    Enabling the debug option and printing the output should give you some hints why it isn’t working. See above how to do that.

    /roundcube/ should be fine as path.

    Regards,
    Philipp

  17. Carl says:

    Howdy,

    Thanks to you I was able to setup SSO (Single Sign On) for my site.

    These scripts helped so much!

    There is just one little thing I hope someone can help with, as I can not figure it out on my own…

    When using http://mydomain.com/roundcube/ everything works.

    But I have a seprate Mail server with a much faster RoundCube setup at http://mail.mydomain.com

    How can I change:

    $rcl = new RoundcubeLogin(“/mail/rc671/”, true);

    To something like:

    $rcl = new RoundcubeLogin(“mail.mydoamin.com”,
    \ true);

    Also, I think I would need to update:

    if ($rcl->isLoggedIn())
    header(“Location: rc671/”);

    And:

    if ($rcl->isLoggedIn())
    header(“Location: rc671/”);

    Thank you for you time,
    Carl.

  18. Philipp says:

    Hey Carl,

    the script is not made for this situation, and I’m not sure it is possible to rewrite it that way. If it would work, I would have made it that flexible when I wrote it.

    Reasons: RC relies on Cookies. And in order to communicate with RC, my script has to read the Cookies from RC and interpret their meaning, _and_ eventually re-set to the end-user’s browser.

    i.e.
    RC < --> script < --> user

    If the script and RC are located on the same host, it can read and write the same Cookies as RC. If, however, it is located on a different server, it is able to read RC’s Cookies (as a client), but cannot re-send them to the end-user client (because you can’t save Cookies for a different host than your own). Therefore, the end-user cannot stay logged in.

    If you have any questions, please feel free to ask.

    Philipp

  19. Diego says:

    thank you !! this post is a big help. You are a genious!

  20. Kit says:

    I am trying to mod a server install and keep getting the following error when running your the rclogin.php script– Parse error: syntax error, unexpected ‘{‘ in /home/xxxxxx/public_html/RoundCube/rclogin.php on line 23

    I have placed the class file in the main usr directory for roundcube.

    Please advise… Your help is greatly apprecited.

    -Kit

  21. Philipp says:

    Hey Kit,

    sorry that it took so long for me to answer but I read your comment on my cell and totally forgot about it…

    1)
    First to the parse error: the rclogin.php file worked for all the others which means that you either made a copy+paste error, or more likely that you’re using a PHP version that doesn’t support try/catch. What PHP version are you using? You need at least PHP 5.0.

    2)
    “I have placed the class file in the main usr directory for roundcube.”
    You don’t have to place the class-file or the rclogin-file in the RC installation. It can reside anywhere within the document root. In fact, the class file could even be outside the doc-root.

    Hope this helps a little.
    Regards,

    Philipp

  22. Kit says:

    Hey Philipp,
    NP

    Well, recently had to re-install server… When I configured through easyapache, I setup both php 4.7 and 5.2, not knowing if some clients would have older versions of code that could possibly break.

    Is there a method where I can call a specific vs of php for this script, becuase it seems to be defaulting to 4.7

    -Kit

  23. Philipp says:

    Hey Kit,

    I think this is a configuration problem of your web server, i.e., most likely apache… Google it and I’m sure you will find a solution …

    Regards,
    Philipp

  24. Aodhan says:

    Hi there, This script looks like exactly what I’m looking for but I’m getting this message error:

    Status: ERROR: Unable to determine the login status. Unable to continue due to technical problems.

    I’m using version 0.3.1.

    My main.inc.php was already set to $rcmail_config['ip_check'] = false and I can log in normally ok.

    my RC installation is at mydomain.com/mail and I have both your files rclogin.php and RoundcubeLogin.class.php in mydomain.com/mail/test

    I have set $rcPath = “/mail/”; in the rclogin.php script, although I get the same arror regardless of what in put here ?

    Help Please !?

  25. Philipp says:

    @Aodhan: The rclogin.php produces a whole lot of debug output. If you send it to me, I can maybe help you here … BUT: Make sure to remove all passwords from the output first :-D

    Regards,
    Philipp

  26. Aodhan says:

    Hi and thanks for getting back to me.

    Where should I see the debug output ? In the same folder as the script ? If so its not been written, thers nothing there.

    If have this set in your script, I assume thats correct ?

    // Set to TRUE if something doesn’t work
    $debug = true;
    $rcPath = “/mail/”;

    Thanks again for your help.

    Aodhan.

  27. Hey there and sorry for not replying immediately.

    when you call the rclogin.php file in your browser, it outputs something
    like “Status: … Login Logout …”. Below that, it prints the debug
    information if you click on “Login” or “Logout”.

    try clicking on “Login” or “Logout” and then it should definitely print
    something … if it doesn’t i can’t think of any reason why it doesn’t.

    you’re using version 0.3.1 right? because one of my readers confirmed
    that it works with that version. i personally haven’t tried it yet.

    sorry i can’t be more help… but without the debug output, it’s simply
    impossible to find out what’s wrong.

    regards,
    philipp

  28. Tim says:

    Hi,
    ist es auch möglich eine SQL abfrage (für die userdaten) zu machen und wie?
    “$rcl->login(“your-email-address”, “plain-text-password”);” Trage ich da einfach die namen der beiden Textboxen ein?

    Vielen dank im Vorraus
    Grüße

  29. Tim says:

    Noch ne kleinere frage, wie wende ich das richtig an (welches verzeichniss hochladen und evtl. daten anpassen)?

    Danke und Grüße

  30. Hallo Tim,

    I’m not quite sure I fully understand what you mean. The login function does not take the names of the textboxes as arguments but rather the actual e-mail address and password.

    For example:
    $rcl->login(“kennedy@example.com”,”ich-bin-ein-berliner”),
    or $rcl->login($_POST['username-textbox'], $_POST['password-textbox']);

    but NOT:
    $rcl->login(“username-textbox”,”password-textbox”);

    What names/data do you want to retrieve from the SQL database?

    Regards,
    Philipp

  31. Tim says:

    Hi Philipp,
    ich möchte die User nicht über den IMAP Server abfragen sodern aus einer DB.
    Ersetzte ich die index.php mit Ihrer?

    Grüße

  32. Rabah says:

    hi i use rclogin scritp all its ok. but when i receive the response it show me the php code not the html page
    see above
    thanks a lot of
    RESPONSE:

    HTTP/1.1 200 OK
    Date: Mon, 07 Jun 2010 14:42:58 GMT
    Server: Apache/2.2.8 (Ubuntu) PHP/5.2.4-2ubuntu5.10 with Suhosin-Patch mod_ssl/2.2.8 OpenSSL/0.9.8g
    X-Powered-By: PHP/5.2.4-2ubuntu5.10
    Expires: Thu, 19 Nov 1981 08:52:00 GMT
    Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
    Pragma: no-cache
    Connection: close
    Transfer-Encoding: chunked
    Content-Type: text/html; charset=UTF-8

    989

    RoundCube Webmail :: Bienvenue sur RoundCube Webmail

    /* */

    Bienvenue sur RoundCube Webmail

    Utilisateur

    Mot de passe

  33. Hello Rabah,

    the rclogin script should be used only for testing purposes because it always prints the debugging output at the end (cmp. $rcl->printDebugStack()).

    Try to use the code given in the section “sample usage” and/or disable debugging in the constructor of the RoundcubeLogin-class: $rcl = new RoundcubeLogin(…, false);

    Regards,
    Philipp

  34. Martin says:

    Hi Phillip, i have a problem with the login to roundcube using your script, the problem is that i have linked my login and the roundcube login, so i dont have to login every time i need to enter roundcube, but my system doesn’t keep the login, so i login and 3 seconds after i’m returned to the login page, what could be my problem??
    Thanks

  35. It’s very difficult to determine a problem without any code and/or a detailed description. Does the rclogin.php script work as expected, i.e. does it allow you to log-in/out to roundcube?

    To make a Single Sign-On script as you described it, you need to:

    1. create your own login-page with a HTML form (login.php)
    2. save the username/password when the user logs in (e.g. in the $_SESSION variable)
    3. perform a $rcl->login(…) operation if the user asks to access the webmail interface

    Sorry I can’t help more. Post some code if you have further questions …

    Regards,
    Philipp

  36. Martin says:

    Hello Phillip, do you know how i can make a contact list, with some of my contact, so i dont have to write them all when i want to send them a mail??
    it would a great help if you can help me.
    Thanks

  37. Arek says:

    hello,
    Is there any way to auto login to RoundCube? Problem is that i dont have access to any files of RoundCube, I was trying to set IE or FF to remamber passwords but it dont work, so Im thinking about making some script. Mr Philipp if You have any idea how to help me pls write msg :)

    Best regards

  38. Hey Arek,

    my script only works if the RoundcubeLogin-file and your own script reside on the same host as the RC installation, because it has to read RCs cookies.

    It will NOT work, if your script is on a different host, e.g. http://mywebsite.myprovider.tld < --> http://webmail.myprovider.tld

    Hope this helps a little.

    Regards,
    Philipp

  39. Sylvain says:

    Hello,

    The script tell’s me that there is no rouncube installation find. But it really is there. The file’s are my own so it’s not a provider install.

    $rcl = new RoundcubeLogin(“http://www.startnet.be/mail/”, true);
    I have already try for /mail/ ant http://startnet.be/mail/ the same problem

    ERROR: Technical problem, No Roundcube installation found at ‘http://www.startnet.be/mail’
    REQUEST:

    GET http://www.startnet.be/mail HTTP/1.1
    Host: http://www.startnet.be
    Cookie: 92d2a1256cd02a582ac9d3dec5154d99=239dca458af583caa6f194ba2d0606ef; 87f58a10ed835bc6d150e0ccfc067c48=71759a66171227d5ca319e575b42fda4; 3ab17c82a5752b030f3c75a65dc13787=54b2f888386adab02f720ced84f63c7a; ja_purity_tpl=ja_purity; roundcube_sessid=e12384f63f04b8adf842428e444113e4; PHPSESSID=d04ee7422f070b4c806c9403902fda1f
    Connection: close

    Regards,

    Sylvain

  40. Rich says:

    Great script saved me tons of time.

    Just to help others who might be having the same problem as me. I kept getting a 404 message from the roundcube request. This was because apache was not figuring out what virtual server I wanted and was defaulting to the wrong virtualserver. I simply added an alias for /roundcube in apache conf and it solved the issue. I do not know why the virtual server was not working with socket request.

    Now just make it work for squirrel mail :) and all my problems will be solved.

    Thanks again

    Rich

  41. Hey Rich,

    thanks for sharing!
    Oh nooo, SquirrelMail … hehe :-D

    Regards,
    Philipp

  42. Alex says:

    This doesn’t work anymore since 0.5.1, they have added a CSRF token to the login submission :)

  43. Thank you Alex for this hint.

    I updated the class. It should now work with older versions as well as Roundcube 0.5.1. It handles the request token correctly.

  44. Tim Canty says:

    This script looks like it will fit the task that i require perfectly, however i have been trying to get this to work for the last few hours. I have been getting can’t find path error, whatever i put in e.g. /rmail/ etc doesn’t work.

    However I have just discovered i’m using version 0.5.2 not 0.5.1, and looking at the change log they have made a few changes to fix sessions and Stateless request tokens etc.

    Would you be upgrading this to work with 0.5.2? or should i downgrade to 0.5.1?

  45. Tim Canty says:

    I started afresh and gone back to 0.5.1 and still getting the same problem,

    I just keep getting Status: ERROR: No Roundcube installation found at ‘/rmail/’

    I’ve tried it with the domain name included, tried it under http and https. I just can’t figure out what i’m missing.

    Any pointers of things that i can try?

  46. Tim Canty says:

    Sorry to keep posting, i finaly craked it…

    The problem was with this line
    $host = ($port == 443) ? “ssl://localhost” : “localhost”;

    I changed localhost to the domain and now it works.

    cheers for all the hard work on the script :)

  47. Hey Tim,

    that’s weird. Is your RoundcubeLogin script on the same machine as the Roundcube installation? In my experience, it will not work, if they are on separate machines: because of the different IPs, this configuration is not possible.

    Did you test it with Roundcube 0.5.2 yet?

    Rgrds,
    Philipp

  48. D. Kuipers says:

    Hi Philipp,

    Thanks for the very usable script!

    I had the same problem as uzu and Tim Canty (server returns a 400 Bad Request).
    I changed
    $host = ($port == 443) ? “ssl://localhost” : “localhost”;
    to
    $host = (($port == 443) ? “ssl://” : “”) . $_SERVER['HTTP_HOST'];

    The problem can be found in the Apache logs:
    [error] Hostname localhost provided via SNI and hostname xxxxxx.xx provided via HTTP are different.
    It seems that the Server Name Indication feature found on servers which can host multiple secure virtual hosts ’causes’ this.

    Anyway, thanks for the script. It works like a charm with the minor change I made.

  49. Daniele says:

    Hi Philipp,
    your script sounds very promising but I can’t make it working.
    I set false to ip_check but when I try to login through rclogin.php script no error is shown but I have:
    Status: We’re NOT logged in.
    And the system give me the login page. I can’t understand it. Is there some php inizializzation issues (such as register_global)?

    Thank you
    Daniele

  50. nadj says:

    Hi I just want to thank you, everithing I looked for.
    And it works for me out of the box. :)

  51. Dany says:

    After upgrading PHP 5.2.x to 5.3.x

    ERROR: Technical problem, Unable to determine the login status. Unable to continue due to technical problems.

  52. I suppose I’ll have to test it with the newer versions at some point …
    Did you try running the rclogin.php script? Can you give me the output from there?

  53. MatBoy says:

    I get this error too, something seems to be changed in the new version. I hope we can fix this soon.

    Why not make a topic about this plugin @ http://www.roundcubeforum.net so everyone can add fixes ?

  54. Dany says:

    $host = ($port == 443) ? “ssl://”.$_SERVER['HTTP_HOST'] : $_SERVER['HTTP_HOST'];
    (Tim Canty solution)

    Works with PHP 5.3.x and roundcube 0.5.3
    Tested only with https

    With localhost I have bad request errors with:
    Hostname localhost provided via SNI and hostname http://www.mydomain.com provided via HTTP are different

    When I tried to replace localhost with domain name I get:
    [Mon Jun 13 18:51:23 2011] [error] Hostname mydomain.com provided via SNI and hostname http://www.mydomain.com provided via HTTP are different

    So the best solution is HTTP_HOST, because http://www.domainname and domainname is not the same. But is not perfect, sometimes I get the login page and cant login, event with the right password dont know why.

    Thank You for Your script :)

  55. MatBoy says:

    Dany,

    I have tried your solution and my rclogin.php keeps loading forever.

    Cheers,

    Matt

  56. MatBoy says:

    OK, my loading was a quote error…. but I still get the RC version error .

  57. pascoli says:

    Thanks for sharing this great php script. I try to run them but i have some problems. I exaclty followed your description but I allway get an error. I tried to run your rclogin.php script for my roundcube v0.3.1.

    Status: ERROR: Unable to determine login-status due to technical problems.
    LOGIN STATUS UNKNOWN:
    Neither failure nor success. This maybe the case if no session ID was sent

    I tried also alle the tips in the comments written above.
    Any suggestions?

    LG pascoli

  58. pascoli says:

    Problem solved, i dont know what was the fault. After a reinstallation of RC erveythink worked fine.

    Thanks agian for sharin such a nics scirpt!

    Cheers, pascoli

  59. Stefan Weise says:

    Hey Philipp,

    can you give a hint on how to use your script with joomla cms? I bought a roundcube component but it doesn’t work, but I think your script is exactly what I need and nearly all the work is already done, but sadly I have no experience with PHP and Web Applicatios at all.. :(

    Thx in advance
    Stefan

  60. Stoney says:

    Hi,

    Unfortunately it fails on RC 0.5.2.. :(

  61. Bakhtiyor says:

    Greate job!
    Thanks a lot for your contribution in roundcube. I was looking forward to find a solution for autologin in 0.5.3 version of roundcube and your solution worked perfectly. I highly appreciate your help.
    Best regards,
    Bakhtiyor

  62. dear philippi,
    i devoloped a site with phpfox. i want to integrate the webmail to it.it maybe round cube or hive mail
    or something else. is there any posiblity? if any chance pls give me the reply to my mail ID.

  63. Angel says:

    I have created a custom form and am trying to use this to process the login.

    $rcl->login($_POST["_user"];, $_POST[“_pass”);

    I have Roundcube-0.5.3,1 and am getting “ERROR: Technical problem, Unable to determine the login status. Unable to continue due to technical problems.”

  64. Angel says:

    I have RC v0.5.3,1 and have not been able to get this to work, even with an unmodified rclogin.php. Any help would be appreciated.

  65. Bakhtiyor says:

    Hi everybody.

    A lot of thanks to Phillip. I would like to know whether somebody knows where to get this kind of autologin script for Roundcube version 0.6. As far as I understood and had tested this script doesn’t support Roundcube 0.6 yet.

    Thank you.

  66. Johannes says:

    Hi everybody,
    I am also interested in this script for the newest version of Roundcube. I get it almost to work, but RC displays a message, that the Session is not valid.
    Is there any chance that the script is modified soon?
    Anyway thanks to Philipp, it would be a great help.
    Thank you.

  67. Paolo says:

    Hi,

    me too i’ve problems with roundcube 0.6. It’s the same problem of Johannes.
    Please help-us!!!

    Best regards
    Paolo

  68. jluis says:

    Anyone know what changed in the last version that the script does not work

  69. David B says:

    It’s very simple custom login form — customize at yours needs. Tested RC 0.7

    add this code in your RC root folder

    get_request_token();

    ?>

    <input type="hidden" value="” name=”_token”>

  70. David B says:

    It’s very simple custom login form — customize at yours needs. Tested RC 0.7

    add this code in your RC root folder

    http://www.fileserve.com/file/H4TzZ3V/dologin.zip

  71. Tim Canty says:

    Anybody got this working for RC 0.6 or RC 0.7? As a few others has stated it says that the Session is not valid…

    It appears to login, but then complains about the session…

    I’ve tried the debug options, but unfortuently doesn’t help show anything that is wrong.

    Any Ideas?

  72. Luciano T. says:

    Script provided by Divid B. work only if you host the page on the same webserver of roundcube installation. How can work the script to install de script in the same webserver of a main site where you want to give access to webmail by filling the form on main site ? I’ m trying with remote include: but not working

  73. Jesus says:

    It doesn’t work with RC 0.7.1. It appears to do everything fine (get statsu, login and logout) but when it redirects to RC, it says that session is not valid.

    Any help? Thanks.

  74. Peero says:

    I’ve got the excact same problem as Jesus, jluis, Paolo and Johannes.

  75. Thomas Andersen says:

    Same problem here.. ” Your session is invalid or expired”

  76. Updated the script. Works like a charm again!!

  77. Rohan says:

    I must agree, The script works fantastic again on the latest version of RC.

    Philipp, you have saved us all again!!!!

  78. Kyle says:

    Looks like it’s broken again for 0.8. I suspect this line in the changelog:

    - Deprecate $DB, $USER, $IMAP global variables, Use $RCMAIL instead

    Sucks because 0.8 has made a ton of improvements, but I am dead in the water without this script.

  79. Leonardo Castillo says:

    Greetings. Where I can get the script updated to version 0.7.2.?

    thanks

  80. Evgeny says:

    Hi!
    Thank you for plugin.
    It is strange, but on some hostings request to ‘localhost’ returns 404 error.

    If you met this, change lines in function sendRequest:

    $host = ($port == 443) ? “ssl://localhost” : “localhost”; (line 329)

    to

    $host = $_SERVER['HTTP_HOST'];

    if ($port == 443)
    $host = “ssl://$host”;

  1. [...] post them. How can I create such a session that valid ? What I found are: roundcube autologin Roundcube login via PHP script – Yet another web log Where I think the second one is the best so far, but not something that I would like to do. I [...]

  2. [...] so we can continue using this plugin instead of this website that (we never know) can go down: Roundcube login via PHP script – Yet another web log I hope everyone is willing to help this plugin live further Cheers, [...]

Leave a Reply