Steven SullivanSteven Sullivan - 26th January 2018

Roundcube logoAfter some relentless searching I found a great plugin that supports multiple IMAP accounts for Roundcube tucked away on BitBucket. It’s a great tool that simply adds a drop down of the IMAP accounts you’ve set-up  to the top right area of Roundcube, replacing your email address in that area.

Instructions on how to install multiple IMAP accounts plugin for Roundcube

  1. First, head over to here and click the ‘Download repository’ link
  2. Download it, and rename the folder to ident_switch
  3. Upload it to the /path/to/roundube/plugins/ folder
  4. Use the contents (for MySQL) of /path/to/roundcube/plugins/ident_switch/SQL/mysql.initial.sql and add it to your Rondcube database (you can do this by using phpMyAdmin). It will create a new database table named ident_switch
  5. As the script has not been updated for a while, it does not work for version 1.3. I created a fix, so make sure you head over here (or scroll to the bottom of this page for the code) and copy/paste the Javascript code (overwriting the entire file) into the file /path/to/roundcube/plugins/ident_switch/ident_switch.min.js
  6. Now you’re ready Logout and Login to Roundcube.
  7. Once you’re logged in navigate to Settings -> Identities and once you add a new Identity you’ll see a new section to add the IMAP details. Fill the fields in, add the identity and you’ll see the new drop-down menu at the top.

 

Screenshot

Updated code for ident_switch.min.js

$(function(){var $truName=$('.topright .username');if($truName){$sw=$('#plugin-ident_switch-account');if($sw){$sw.prependTo('#topline .topright');$truName.hide();$('#plugin-ident_switch-account:first-child').show();}}
$("INPUT[name='_ident_switch.form.enabled']").change();$("SELECT[name='_ident_switch.form.secure']").change();plugin_switchIdent_processPreconfig();});function plugin_switchIdent_processPreconfig(){var disFld=$("INPUT[name='_ident_switch.form.readonly']");disFld.parentsUntil("TABLE","TR").hide();var disVal=disFld.val();if(disVal>0){$("INPUT[name='_ident_switch.form.host']").prop("disabled",true);$("SELECT[name='_ident_switch.form.secure']").prop("disabled",true);$("INPUT[name='_ident_switch.form.port']").prop("disabled",true);}
if(2==disVal){$("INPUT[name='_ident_switch.form.username']").prop("disabled",true);}}
function plugin_switchIdent_enabled_onChange(e){var $enFld=$("INPUT[name='_ident_switch.form.enabled']");$("INPUT[name!='_ident_switch.form.enabled'], SELECT",$enFld.parents("FIELDSET")).prop("disabled",!$enFld.is(":checked"));plugin_switchIdent_processPreconfig();}
function plugin_switchIdent_secure_onChange(e){var $secSel=$("SELECT[name='_ident_switch.form.secure']");var $portFld=$("INPUT[name='_ident_switch.form.port']");if('SSL'===$secSel.val().toUpperCase())
$portFld.attr("placeholder",993);else
$portFld.attr("placeholder",143);}
function plugin_switchIdent_switch(val){rcmail.http_post('plugin.ident_switch.switch',{'_ident-id':val,'_mbox':rcmail.env.mailbox});}
function plugin_switchIdent_fixIdent(iid){if(parseInt(iid)>0)
$("#_from").val(iid);}

4 thoughts...

  1. elle69 says:

    Hello Steven,
    I followed all the steps described but I still have the error [ident_switch.form.readonly].

    Could you help me find a solution?
    Thanks

    1. SSULLIVAN88 says:

      You can ignore it. If you want to disable it, in either config.php or config.inc.php.dist change:

      ‘readonly’ => true

      to

      ‘readonly’ => false

      This will disable the fields from being read only.

      1. elle69 says:

        Hello SSULLIVAN88,
        I try this, but no solve the problem, the IMAP form not write in database.

        1. SSULLIVAN88 says:

          You might want to check the error log as that should help you understand why it’s not saving to the database. You don’t have the config file setup do you?

          Get Outlook for iOS

Leave a Reply

Your email address will not be published. Required fields are marked *