The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

IMAP::Admin - Perl module for basic IMAP server administration

SYNOPSIS

  use IMAP::Admin;
  
  $imap = IMAP::Admin->new('Server' => 'name.of.server.com',
                           'Port' => port# (143 is default),
                           'Login' => 'login_of_imap_administrator',
                           'Password' => 'password_of_imap_adminstrator');

  $err = $imap->create("user.bob");
  if ($err != 0) {
    print "$imap->{'Error'}\n";
  }
  $err = $imap->delete("user.bob");

  %quota = $imap->get_quota("user.bob");
  $err = $imap->set_quota("user.bob", 10000);

  %acl = $imap->get_acl("user.bob");
  $err = $imap->set_acl("user.bob", "admin", "lrswipdca", "joe", "lrs");
  $err = $imap->delete_acl("user.bob", "joe", "admin");
 
  @list = $imap->list("user.bob");
  @list = $imap->list("user.b*");

  $imap->{'Capability'} # this contains the Capabilities reply from the IMAP server

DESCRIPTION

IMAP::Admin provides basic IMAP server adminstration. It provides functions for creating and deleting mailboxes and setting various information such as quotas and access rights.

It's interface should, in theory, work with any RFC compliant IMAP server, but I currently have only tested it against Carnegie Mellon University's Cyrus IMAP. It does a CAPABILITY check for Cyrus specific extensions to see if they are supported.

Operationally it opens a socket connection to the IMAP server and logs in with the supplied login and password. You then can call any of the functions to perform their associated operation.

MAILBOX FUNCTIONS

RFC2060 commands. These should work with any RFC2060 compliant IMAP mail servers.

create makes new mailboxes. Cyrus IMAP, for normal mailboxes, has the user. prefix. create returns a 0 on success or a 1 on failure. An error message is placed in the object->{'Error'} variable on failure.

delete destroys mailboxes. delete returns a 0 on success or a 1 on failure. An error message is placed in the object->{'Error'} variable on failure.

list lists mailboxes. list accepts wildcard matching

Currently create and delete only take one argument. This will probably change in the future to allow for mass creation/destruction.

QUOTA FUNCTIONS

NOT RFC2060 commands. I believe these are specific to Cyrus IMAP.

get_quota retrieves quota information. It returns a hash on success and undef on failure. In the event of a failure the error is place in the object->{'Error'} variable.

get_quota takes only one argument, but this will probably change to multiple and/or wildcard matching.

set_quota sets the quota. The number is in kilobytes so 10000 is approximately 10Meg. set_quota returns a 0 on success or a 1 on failure. An error message is placed in the object->{'Error'} variable on failure.

ACCESS CONTROL FUNCTIONS

NOT RFC2060 commands. I believe these are specific to Cyrus IMAP.

get_acl retrieves acl information. It returns a hash on success and under on failure. In the event of a failure the error is placed in the object->{'Error'} variable.

set_acl set acl information for a single mailbox. You can specify more the one user's rights on the same set call. It returns a 0 on success or a 1 on failure. An error message is placed in the object->{'Error'} variable on failure.

delete_acl removes acl information on a single mailbox for the given users. You can specify more the one users rights to be removed in the same delete_acl call. It returns a 0 on success or a 1 on failure. An error message is placed int the object->{'Error'} variable on failure.

The access control information is from Cyrus IMAP. read = "lrs" post = "lrsp" append = "lrsip" write = "lrswipcd" all = "lrswipcda"

KNOWN BUGS

Currently all the of the socket traffic is handled via prints and <>. This means that some of the calls could hang if the socket connection is broken. Eventually the will be properly selected and timed.

CVS REVISION

$Id: Admin.pm,v 1.4 1999/03/05 03:52:00 eric Exp $

AUTHOR

Eric Estabrooks, estabroo@ispn.com

SEE ALSO

perl(1).