I have a bit of an object for vpopmaild working. It will login and retrieve the list of users, and domains. The tarball includes an example program. On my system (a 500MHz PII) running both the daemon and this program it retrieved 3108 users from a single domain in 10.23 seconds, and 1563 domains in 0.90 seconds. I am using CDB.


You can download it here:

http://kimberly.developersdesk.com/vpopmaild-php.tar.gz


Right now it is based on the initial distribution of vpopmaild, and works around the bug I found in list_users. (Missing +)




The functions I have working so far are listed below:

===================================================================

The constructor:

function vpopmaild( $Domain, $User, $Password, $Host='localhost', $Port=89 ) {

$Domain, $User, $Password represent the user you want to login as.
$Host and $Port are optional, with defaults.  You should check for
an error message with the error_message() function after attempting
to create a vpopmaild object.  If there is an error present, you
can't do anything else.


===================================================================


function Quit() {

You should call this before exiting the program to give the server
a chance to clean up gracefully.  The world probably won't end if
you don't but it is possible that sessions will be closed faster
if you do.


===================================================================


function error_message() {

Return the most recent error message, if any, from vpopmaild
operations.  This message will be text, ready for display.


===================================================================


function GetLoginUser() {

Retrive an array full of information about the currently logged in
user.

Array (
    [vpopmail_dir] => /mail
    [uid] => 77
    [gid] => 72
    [name] => postmaster
    [comment] => Postmaster
    [quota] => NOQUOTA
    [dir] => /mail/domains/test.com/postmaster
    [encrypted_password] => $1$zkJe.3SH$7HOl1RbwfKcibL67iXjsh/
    [clear_text_password] => password
    [domain_admin_privileges] => 1
    [system_admin_privileges] => 1
)


===================================================================


function ListUsers( $Domain ) {

Retrieve an array full of information about a domain.  You must be
a system admin to list any domain, or the domain admin of the domain
you wish to list.  The users are in alpha order by Username.

Array (
    [04wcyrti] => Array
        (
            [passwd] => $1$cBacCPRA$LxzczMu7dpn5KjZphYPKU0
            [uid] => 1
            [gid] => 0
            [flags] => 0
            [gecos] => Brigitte
            [dir] => /mail/domains/test.com/9/04wcyrti
            [shell] => NOQUOTA
            [clear_pw] => Fisher
        )

    [095wvsp] => Array
        (
            [passwd] => $1$2lpyyZHz$XmcuvLSZDbOnIaDD9Yf93.
            [uid] => 1
            [gid] => 0
            [flags] => 0
            [gecos] => Antone
            [dir] => /mail/domains/test.com/F/095wvsp
            [shell] => NOQUOTA
            [clear_pw] => Winn
        )
    )


There is a problem with the program I used to load the addresses which caused the last name to appear in the clear_pw field. The program is reflecting what is stored in the files. Spam is useful for something, I built all these test users and domains from the spam I got over a week or two. :)



===================================================================


function ListDomains( $Sort = 'HDT' ) {

Retrieve an array full of information about a domain.  You must be
a system admin to use this call.

Order to display domains:

  TDH  = top-level, mid-level, host
  DTH  = mid-level, top-level, host
  HDT  = host, mid-level, top-level

where you usually see

host.mid-level.top-level

mail.developersdesk.com


Want all the .com together - use TDH Want domain.com, domain.net, domain.org together - use DTH Want them all mixed up in host name order - use HDT

If DomainOrder is not specified, you get HDT.

This example data uses DTH mode.  The data is DomainName => ParentName,
If they both match, the domain is real, if they are different it
is an alias of ParentName.


Array ( [0-0-mydomain.com] => 0-0-mydomain.com [0-0-mydomain.net] => 0-0-mydomain.com [0-0-mydomain.org] => 0-0-mydomain.com [0800commerce.nl] => 0800commerce.nl [fun.21cn.com] => fun.21cn.com [private.21cn.com] => private.21cn.com [263.net] => 263.net [2dayhealth.com] => 2dayhealth.com )


===================================================================


The next two functions are used to create the login user information
block, and may get merged into the constructor, unless they are useful
parsing other incoming structures.

function ParseUser( $UserBlock ) {

function ReadBlock( &$List ) {







Reply via email to