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
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.