01 #!/usr/bin/perl 02 use strict; 03 use IMAP::Client; 04 use Sysadm::Install 0.23 qw(:all); 05 06 my $mailbox = "im_mailbox"; 07 08 my $imap = new IMAP::Client(); 09 $imap->onfail('ABORT'); 10 $imap->errorstyle('STACK'); 11 $imap->debuglevel(0x01); 12 13 $imap->connect( 14 PeerAddr => 'localhost', 15 ConnectMethod => 'PLAIN') or 16 die "auth failure " . $imap->error; 17 18 my $u = getpwuid $>; 19 my $pw = password_read("passwd: "); 20 $imap->authenticate($u, $pw); 21 22 $imap->onfail('ERROR'); 23 $imap->delete($mailbox); 24 $imap->onfail('ABORT'); 25 26 $imap->create($mailbox);