Round Cube webmail with ISPConfig

Discussion in 'General' started by Hagforce, Mar 22, 2007.

  1. Hans

    Hans Moderator ISPConfig Developer

    RoundCube: resolve user names and e-mail addresses

    @Edge,

    I think you're on the right track Edge! :)

    I have something more nice for you:
    Within RoundCube's main.inc.php file there is a line like:

    // Path to a virtuser table file to resolve user names and e-mail addresses
    $rcmail_config['virtuser_file'] = '';

    If you change it to:

    // Path to a virtuser table file to resolve user names and e-mail addresses
    $rcmail_config['virtuser_file'] = '/etc/postfix/virtusertable';
    /etc/postfix/virtusertable

    Then your users are able to login with their loginname AND emailaddress as well!
    (This is not within my howto yet).


    @Hagforce,

    I do not know if choosing the characterset for one single language is possible (yet).
    I also use IlohaMail, this emailclient uses the same default folders as RoundCube (compatible) and has that functionality.
    It has a callendar as well, which is on your wishlist.
     
  2. edge

    edge Active Member Moderator

    Last edited: Mar 23, 2007
  3. Hagforce

    Hagforce New Member

    I tried to edit main.inc
    Code:
      // language has special charset configured
      if (isset($rcube_charsets[$lang]))
        $charset = $rcube_charsets[$lang];
      else
        $charset = 'UTF-8';    
    But that didn`t work.

    I want to use iso-8859-1

    If I can`t set charset per language, where can I set it for the whole installation?

    If you log in with username and if you log in with e-mail different users are created, any way around this?

    And the identity added is [email protected], how do you get [email protected]?
     
    Last edited: Mar 23, 2007
  4. edge

    edge Active Member Moderator

  5. Hagforce

    Hagforce New Member

    Ahh Thank you.

    Now I just need to change the charset and everything is perfect :)
     
  6. Hagforce

    Hagforce New Member

    I appended $rcmail_config['charset'] = '8859-1'; to my main.inc.php, but then I get a blanck page....

    How do you change the charset in this program?
     
  7. Hans

    Hans Moderator ISPConfig Developer

    @Hagforce

    At the moment i do not have a solution for that.
    I've done some tests like adding:

    $rcmail_config['charset'] = '8859-1'; to the main.inc.php

    And even adding lines like these:

    $labels['defaulteconding'] = 'windows-1251';

    or

    $labels['defaulteconding'] = '8859-1';

    or

    $labels['defaulteconding'] = 'iso-8859-1';

    to the language labels.inc file within your RoundCube localization folder, but i did not succeed right now.


    @Edge,

    Thanks for your feedback! Doing so, we can make things better.
    Today i've updated my RoundCube howto, which is published here:
    http://www.howtoforge.com/roundcube_webmail_ispconfig

    The following content has been added:

    To login with usernames AND email addresses change the line:

    // Path to a virtuser table file to resolve user names and e-mail addresses
    $rcmail_config['virtuser_file'] = '';
    /etc/postfix/virtusertable

    into:

    // Path to a virtuser table file to resolve user names and e-mail addresses
    $rcmail_config['virtuser_file'] = '/etc/postfix/virtusertable';
    /etc/postfix/virtusertable

    When a user login with the email address for the first time, within RoundCubes the identities section, the e-mail address will be displayed like: [email protected] As we want the email address to be displayed like [email protected] do the following:

    Change the line 637 within /program/incluse/main.inc file from:

    637 $line = trim($line);

    to:

    637 $line = trim(str_replace("www.", "", $line));
     
  8. Hagforce

    Hagforce New Member

    I made this changes to my installation, so the users don`t spoof addresses.

    I "$a_save_cols" in the save_identity.inc file I remove e-mail.
    From identities.html and editidentity.html in skins I remove the add and delete button.

    But my installation don`t lock good without the right charset, I really hope there is a solution for this.
     
  9. edge

    edge Active Member Moderator

    An other problem is that when a user logs in the 1st time the virtual webname is used as display name (like web1_info)

    The code hack below will remove the web1_ part, leaving only the "info" part as display name.

    This is what you need to change.
    Find in Roundcube's main.inc (it's in /program/included arround line 588):

    PHP:
        // also create new identity records
        
    $DB->query("INSERT INTO ".get_table_name('identities')."
                    (user_id, del, standard, name, email)
                    VALUES (?, 0, 1, ?, ?)"
    ,
                    
    $user_id,
                    
    $user_name,
                    
    $user_email);
    Replace it with:

    PHP:
        // also create new identity records
        
    $DB->query("INSERT INTO ".get_table_name('identities')."
                    (user_id, del, standard, name, email)
                    VALUES (?, 0, 1, ?, ?)"
    ,
                    
    $user_id,
                    
    $user_name preg_replace("/\\w[^\\]]*\\_/"""$user_name),
                    
    $user_email);
    Three more things.

    1) Please note that PHP is not my preferred coding language, and that for sure the "code hack" can be done better!

    2) This will only work on a standard ISPconfig. If you have changed the username to look different (not like web[nr]_name) you will need to change the preg_replace code)

    3) If the user has already logged in once before, the name will stay as is!
     
    Last edited: Mar 25, 2007
  10. Hagforce

    Hagforce New Member

    Thank you guys!

    This install is begining to take form.
    I managed to use UTF-8 after rebuilding the database and doing some changes, so now everything is ok.

    Just one question though, what permissions do you use on the files and folders?

    Now I use apache as owner and 700 on all folders and files, but is this safe?
     
  11. edge

    edge Active Member Moderator

    To keep everything nice in one place instead of doing the above hack you could also do this:

    Find in /program/included/main.inc (arround line 588):

    PHP:
        // also create new identity records
        
    $DB->query("INSERT INTO ".get_table_name('identities')."
                    (user_id, del, standard, name, email)
                    VALUES (?, 0, 1, ?, ?)"
    ,
                    
    $user_id,
                    
    $user_name,
                    
    $user_email);
    Replace it with:

    PHP:
        // also create new identity records
        
    $DB->query("INSERT INTO ".get_table_name('identities')."
                    (user_id, del, standard, name, email)
                    VALUES (?, 0, 1, ?, ?)"
    ,
                    
    $user_id,
                    
    $user_name preg_replace("/\\w[^\\]]*\\_/"""$user_name),
                    
    $user_email str_replace("www."""$user_email));
    The:
    Code:
    $user_name = preg_replace("/\\w[^\\]]*\\_/", "", $user_name)
    will rename "web1_info" to "info"

    The:
    Code:
    $user_email = str_replace("www.", "", $user_email)
    will rename "www.domain.tld" to "domain.tld"

    Putting this all together will endup like "[email protected]" instead of [email protected]
     
    Last edited: Mar 25, 2007
  12. Hagforce

    Hagforce New Member

    Anybody know if there is a way to add more languages to the spell check?
     

Share This Page