+function sqimap_get_user_server ($imap_server, $username) {
+
+ if (substr($imap_server, 0, 4) != "map:") {
+ return $imap_server;
+ }
+
+ $function = substr($imap_server, 4);
+ return $function($username);
+}
+
+/* This is an example that gets imapservers from yellowpages (NIS).
+ * you can simple put map:map_yp_alias in your $imap_server_address
+ * in config.php use your own function instead map_yp_alias to map your
+ * LDAP whatever way to find the users imapserver. */
+
+function map_yp_alias($username) {
+ $yp = `ypmatch $username aliases`;
+ return chop(substr($yp, strlen($username)+1));
+}
+