NAME
XMail::Ctrl - Crtl access to XMail server
www.xmailserver.com
VERISON
version 1.0 of XMail::Ctrl
released 07/06/2001
SYNOPSIS
use XMail::Ctrl;
my $XMail_admin = "aaron.johnson";
my $XMail_pass = "stickman";
my $XMail_port = "6017";
my $XMail_host = "aopen.hank.net";
my $test_domain = "aopen.hank.net";
my $test_user = "rick";
my $xmail = XMail::Ctrl->new(
ctrlid => "$XMail_admin",
ctrlpass => "$XMail_pass",
port => "$XMail_port",
host => "$XMail_host"
) or die $!;
my $au = $xmail->useradd(
{
username => "$test_user",
password => 'test',
domain => "$test_domain",
usertype => 'U'
}
);
$xmail->quit;
DESCRIPTION
This module allows for easy access to the Crtl functions for XMail. It operates over TCP/IP so it can be used to communicate with either Windows or Linux based XMail servers.
The code was written on a Win32 machine and has been tested on Mandrake and Red Hat Linux as well with Perl version 5.6
Overview
All commands take the same arguments as outlined in the XMail documentation. All commands are processed by name and arguments can be sent in the any order. As is outlined above in the useradd statement.
The command structure for XMail allows a fairly easy interface to the command set. This module has NO hardcoded xmail methods. As long as the current ordering of commands is followed in the XMail core the module should work to any new commands unchanged.
The "method" that you pass is automagicly (AUTOLOAD) turned into a part of the arguments you are sending into the object.
That is when you call $xmail->useradd( { %args } );
It is passed to the xcommand method as a hash with the "method" you called added to the %args, so $args{command} would equal useradd in this case. You can pass args in any order due to XMails consistent ordering of ctrl variables. The commands are always in the same order. So we loop through the array of variables in the order XMail expects them and add them to the "command" if a corresponding %args value is present. Please see the source for more information.
Any command that accepts vars can use the following:
To send uservarsset add a vars anonymous hash, such as:
$xmail->uservarsset( {
domain => 'aopen.hank.net',
username => 'rick',
vars => {
RealName => 'Willey FooFoo',
RemoteAddress => '300.000.000.3',
VillageGrid => '45678934'
}
} );
The ".|rm" command can used as described in the XMail docs.
BUGS
There must be some
AUTHOR
Aaron Johnson aaron@provillage.com
THANKS
Thanks to Davide Libenzi for a sane mail server with an incredibly consistent interface for external control.
Thanks to Mark-Jason Dominus for his wonderful classes at the 2000 Perl University in Atlanta, GA where the power of AUTOLOAD was revealed to me.
Thanks to my Dad for buying that TRS-80 in 1981 and getting me addicted to computers.
Thanks to my wife for leaving me alone while I write me code :^)
COPYRIGHT
Copyright (c) 2000, Aaron Johnson. All rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.