in reply to Re^3: Downloading IMAP Folders to mbox file
in thread Downloading IMAP Folders to mbox file
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Downloading IMAP Folders to mbox file
by sgifford (Prior) on Jun 18, 2006 at 22:11 UTC | |
by madbombX (Hermit) on Jun 19, 2006 at 03:41 UTC |