NAME

Mail::vpopmail - Utility to get information about vpopmail managed email addresses

SYNOPSIS

use Mail::vpopmail;

my $vchkpw = Mail::vpopmail->new();

my $vchkpw = Mail::vpopmail->new(cache => 1, debug => 0);

DESCRIPTION

Mail::vpopmail provides serveral functions for interacting with vpopmail. This module can be useful especially when hashing is turned on, as you can not predict the location of the domain's nor the mailbox's directories.

CONSTRUCTOR

new( [OPTIONS] );

OPTIONS are passwed in a hash like fashion, using key and value pairs. Possible options are:

cache - Cache results of queries (0=Off, 1=On). Default=On.

debug - Print debugging info to STDERR (0=Off, 1=On). Default=On.

get( email => $email, field => <fields> );

email - the email address to get properties on field - the field(s) you want to be returned (may be comma separated):

dir - return this domain's vpopmail domains directory

crypt - return the encrypted password

uid - return the uid

gid - return the gid

comment - return the comment, if available

maildir - return this user's maildir

quota - return the quota (you have to parse this yourself)

plain - return the plain text password, if available
get( domain => $domain, field => <field> );

domain - the domain to get properties on field - the field want to be returned:

	mailboxes - return an array reference containing all the mailboxes

   all - return an array ref of hash refs of all data for the domain
	

EXAMPLES

	use strict;
	use Mail::vpopmail;

	my $vchkpw = Mail::vpopmail->new(cache=>1, debug=>0);


	# find all domains
	my $domains_aref = $vchkpw->alldomains(field => 'name');
	foreach my $domain (@${domains_aref}){
		print "$domain\n";
	}

	# find all domains and their directories
	my $dirlist_aref = $vchkpw->alldomains(field => 'dir');
	foreach my $href (@${dirlist_aref}){
		print "$href->{name} => $href->{dir}\n";
	}

	my $domain = shift;
	unless(defined($domain)){
		print "enter domain: ";
		chop($domain=<STDIN>);
	}


	# find all mailboxes in a given domain
   my $mailboxes_aref = $vchkpw->domaininfo(domain => $domain, field => 'mailboxes');
   foreach my $mailbox (@{$mailboxes_aref}){
      print "found mailbox: $mailbox for domain: $domain\n";
   }

	# find all properties for a given domains
   my $alldata_aref = $vchkpw->domaininfo(domain => $domain, field => 'all');
   foreach my $href (@{$alldata_aref}){
      print "found data for $domain:\n";
      while(my($key,$value) = each %{$href}){
         print " found $key => $value\n";
      }
   }

	# individual user stuff
	my $email = shift;
	unless(defined($email)){
		print "email address: ";
		chop($email=<STDIN>);
	}

	my $dir = $vchkpw->userinfo(email => $email, field => 'dir');
	print "dir: $dir\n";
	my ($crypt,$uid,$gid) = $vchkpw->userinfo(email => $email, field => 'crypt,uid,gid');
	print "crypt/uid/gid: $crypt/$uid/$gid\n";
	my $comment = $vchkpw->userinfo(email => $email, field => 'comment');
	print "comment: $comment\n";
	my $maildir = $vchkpw->userinfo(email => $email, field => 'maildir');
	print "maildir: $maildir\n";
	my $quota = $vchkpw->userinfo(email => $email, field => 'quota');
	print "quota: $quota\n";
	my $plain = $vchkpw->userinfo(email => $email, field => 'plain');
	print "plain: $plain\n";

CAVEATS

This version does not support SQL based vpopmail solutions.

AUTHOR

Jeremy Kister - http://jeremy.kister.net/

1 POD Error

The following errors were encountered while parsing the POD:

Around line 73:

You forgot a '=back' before '=head1'