Re: Is there a *SIMPLE* usage guide?!?
David A Golden <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.mail-box |
|---|---|
| Message-ID | <5.2.0.9.2.20040229200435.037e7168@localhost> |
It's a huge module with a lot of features and a lot of documents. Start with the cookbook:
http://perl.overmeer.net/mailbox/html/Mail::Box-Cookbook/index.html
From my own ~/bin folder, here's an example of a short script I use to copy messages from one folder to another. (I do some bulk copying of stuff for spam analysis.)
Good luck!
David
#!/usr/bin/perl -w
use strict;
use Getopt::Std;
use Mail::Box::Manager;
my %opts = ( "i" => undef,
"o" => undef,
"c" => undef );
getopts("i:o:c:", \%opts);
die "Usage: $0 -i <input mailbox> -o <output mailbox> -c <# messages to move>\n"
unless ($opts{i} and $opts{o} and $opts{c});
my $mbm = Mail::Box::Manager->new();
my $inbox = $mbm->open($opts{i}, access => 'r')
or die "Can't open $opts{i}\n";
my $outbox = $mbm->open($opts{o}, access => 'rw', create => 1)
or die "Can't open $opts{o}\n";
my $num = $opts{c};
my $i = 0;
for my $msg ($inbox->messages) {
$mbm->copyMessage($outbox, $msg);
last if ++$i >= $num;
}
$outbox->write();
print "Copied $i messages from $opts{i} to $opts{o}\n";
print "$opts{i} contains " . $inbox->messages . " messages.\n";
print "$opts{o} contains " . $outbox->messages . " messages.\n";
$inbox->close();
$outbox->close();
exit;
At 2/28/2004 04:47 PM, Abraham Nelson wrote:
>Is there an actual, simple useage guide for this
>module?
>
>I'm trying to write a script that will move some
>message from my main inbox to a new folder so I don't
>have to do it manually in Pine, but the
>massive,encyclopedia-sized,multi-self-referencing
>'manual' of this module gives me F-ALL in the way of
>actual useful information.
>
>__________________________________
>Do you Yahoo!?
>Get better spam protection with Yahoo! Mail.
>http://antispam.yahoo.com/tools