From: Haim Dimermanas (no email)
Date: Thu Dec 20 2001 - 19:24:33 EST
Dustin Puryear wrote:
>
> The documentation on Cyrus::IMAP, at least for perldoc, is a bit sparse. How
> do I explicitly define the user and password to use for authentication via:
>
> $client->authenticate()
>
The doc for Cyrus::IMAP sucks! I had to spend 2 days reading the module to
figure it out. It's good to have the source :)
#!/usr/bin/perl -w
use strict;
use Cyrus::IMAP::Admin;
my $mailhost = 'localhost';
my $username = 'mailadmin';
my $password = '';
my $cnx = Cyrus::IMAP::Admin->new($mailhost);
$cnx->authenticate(-user => $username, -password => $password, -mechanism =>
'login')
|| die "Cannot authenticate to server as $mailhost_username\n$!";
# Now we have a connection stored in $cnx
# Let's retrieve the mailboxes for a particular user
my @mailboxes = $cnx->list("user.$username");
Haim
|
|
|