[horde] selecting imap server based on ip address

Vilius Šumskas vilius at lnk.lt
Wed Jul 18 11:30:41 UTC 2007


Hello,

> I have 1 horde/imp server and 2 imap server.
> I would like to select 1 imap server based on ip address in
> imp/config/servers.php
> 
> example: if network = 192.168.0.0 then imap server = imap1.example.com
>          if network = 192.168.1.0 then imap server = imap2.example.com
> 
> is it possible ?

A quick and dirty hack:

if (substr($_SERVER['REMOTE_ADDR'], 0, 10) == '192.168.0.') {
	$servers['imap']['server'] = 'imap1.example.com';
} elseif (substr($_SERVER['REMOTE_ADDR'], 0, 10) == '192.168.1.') {
	$servers['imap']['server'] = 'imap2.example.com';
}

You may need to adjust it to your needs but it should work.

-- 
  Best Regards,

  Vilius Šumskas
  LNK TV system administrator
  mob.: +370 614 75713
  http://www.lnk.lt



More information about the horde mailing list