[imp] Using vinfo in IMP 3.1

Eli eli@experthost.com
Mon, 19 Aug 2002 10:46:07 -0400


Nobody has got back to me on this (I don't expect an answer like as if
you're my students!, but...) and it's really important.  Once I solve
this problem I can leave you all alone :)  So, just forwarding my
message to the list again hoping that someone can shed some light on my
problem!

Thanks,

Eli

> -----Original Message-----
> From: imp-bounces@lists.horde.org 
> [mailto:imp-bounces@lists.horde.org] On Behalf Of Eli
> Sent: Friday, August 16, 2002 10:24 AM
> To: imp@lists.horde.org
> Subject: RE: [imp] Using vinfo in IMP 3.1
> 
> 
> 
> Ok, I fiddled around, tried to figure out when this vinfo 
> function gets
> called and I'm not sure I have it working right, or I just don't
> understand what it's real purpose is.
> 
> Here is the code I put as the imp_get_vinfo function:
> 
> if (!function_exists('imp_get_vinfo')) {
>     function imp_get_vinfo ($type = 'username') {
>         global $server, $imp;
> 
>         if 
> (preg_match('/(.*)@.*\.?([a-zA-Z0-9\-]+\.?[a-zA-Z0-9\-]+)$/',
> $imp['user'], $matches)) {
>             $imp['user'] = $matches[1];
>             $vdomain = strtolower($matches[2]);
> echo "vdomain: $vdomain\r\n";
> 
>             if (getmxrr($vdomain, $matches)) {
>                 $mserver = strtolower($matches[0]);
> echo "mserver: $mserver\r\n";
> 
>                 $server['imap']['server']     = $mserver;
>                 $server['imap']['smtphost']   = $mserver;
>                 $server['imap']['maildomain'] = $mserver;
>             }
>             else {
>                 return new PEAR_Error('unable to get MX info');
>             }
>         }
> 
>         print_r($imp);
>         print_r($server);
> 
>         return $imp['user'];
>     }
> }
> 
> It never echo's the 2 debug echos I put in there, and I even entered a
> full "user@domain.com" username at the login screen, so I don't know
> what's going on.
> 
> Basically what I want to be able to do is at the login screen, all you
> see is the username, password, and language field.  You enter 
> your full
> email address in the username box, and your email password in the
> password box.  When you hit Login, it takes your username, gets the
> domain name and does a getmxrr() lookup on it and changes the IMAP
> server (that you will connect to) to the first MX record it finds.  It
> also sets the smtphost and maildomain as the same server.  It doesn't
> alter the login name, as our mail servers require a full email address
> for username login.
> 
> I don't have enough time to look through everything in Horde 
> and IMP to
> try and debug this, as I have lots of other projects/work to deal with
> at work.  I really need to know how to do this, as we are 
> trying to set
> up IMP to be used as our new webmail system here.
> 
> Eli.