You have been a great help so far and the code you gave me is working like a charm. I am just having a real problem grasping the concept of how this module works. I have been sitting here for a few hours now trying to figure out the best way to delete (or mark for deletion) and then expunge all the messages in both folders that I am attempting to work with.
my $imap_client = Mail::IMAPClient->new( Server => 'imapserver.com:14
+3',
User => 'uname',
Password => 'pass')
or die "IMAP Failure: $!";
foreach my $box qw( SPAM HAM ) {
my $imap = $mgr->open( type => 'imap',
imap_client => $imap_client,
folder => "$box")
or die "Couldn't create IMAP Client: $!\n";
open (MBOX, ">/home/mail/mbox/$box")
or die "Couldn't create MBOX folder: $!\n";
close(MBOX);
my $mbox = $mgr->open( type => 'mbox',
folder => "/home/mail/mbox/$box",
access => 'rw')
or die "Couldn't open MBOX folder\n";
my @msgs = $imap->messages('ALL')
or die "Couldn't get all messages\n";
$mgr->copyMessage($mbox,@msgs)
or die "Couldn't copy messages\n";
# ... I know the msgs delete code goes here ...
}
$imap->logout();
Basically I know what needs to be done, but I just can't grasp how to do it. Thanks again for all the help thus far.
Eric |