[imp] Using vinfo in IMP 3.1

Eli eli@experthost.com
Fri, 16 Aug 2002 10:24:23 -0400


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.

Quoting Eli <eli@experthost.com>:

 | I am trying to set up IMP for a webhosting company that also does
email,
 | and we need some way to allow users to simply log in by using their
 | email address and password.
 | 
 | I was told about the vinfo stuff, and I took a look at it, but I'm at
a
 | loss of how to get the login info the user specifies.  I know PHP, so
I
 | can write the code myself, but I don't have a clue where to get/store
 | the data that I'd be parsing.
 | 
 | I need to know how to access the data the person gives at the login
page
 | (the username) so I can parse it, and then I need to know where I can
 | store the following pieces of data I would get from parsing it:  the
 | server, the maildomain, and the smtphost.  Also, I wonder if I would
 | just be editing the settings for a pre-defined server from the
 | servers.conf, or what?  The server type would be IMAP, and right now
I
 | have all the example servers commented out.

You're there.  Basically all the information that you need for Horde/IMP
is in the form of examples in the configuration files.  I think it is 
quite clear.  If there is something you don't understand, please ask
a specific question and I'm sure someone will answer it.  That makes
more
sense than trying to cover all the potential solutions.

ed

 | 
 | Thanks in advance,
 | 
 | Eli.