A.L.E.C wrote:
> Pedro R. Benito da Rocha wrote:
>> Hello all,
>>
>> Here is the plugin and default config (rename it to config.inc.php). See
>> attached files.
> 
> Did you try imap_connect/smtp_connect hooks to overwrite host setting?
> 


<?php

/**
  * Sample plugin to override default server(s).
  */
class select_server extends rcube_plugin
{
   public $task = 'mail';

   function init()
   {
     $this->add_hook('imap_connect', array($this, 'get_server'));
     $this->add_hook('smtp_connect', array($this, 'get_server'));
   }

   function get_server($args)
   {
     $rcmail = rcmail::get_instance();

     // add code to determine which server user is on
     $new_server = "new.server.dom";

     // alter the server as follows
     if (isset($args['host'])) {
       $args['host'] = $new_server;
     }
     if (isset($args['smtp_server'])) {
       $args['smtp_server'] = $new_server;
     }

     return $args;
   }

}

_______________________________________________
List info: http://lists.roundcube.net/dev/

Reply via email to