Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: UNIX Mail Box and Mail Parsing

by crouchingpenguin (Priest)
on May 21, 2003 at 21:44 UTC ( [id://259905]=note: print w/replies, xml ) Need Help??


in reply to UNIX Mail Box and Mail Parsing

Have you looked at Mail::Box ? It does all you want and more.

#!/usr/bin/perl use strict; use warnings; use Mail::Box::Manager; my $manager = Mail::Box::Manager->new(); # source folder my $source_folder = $manager->open( folder => '/path/to/folder' ) or die $!; # two destinations my $destination_1 = $manager->open( folder => '/path/to/destination/1', create => 1, access => 'rw', ) or die $!, my $destination_2 = $manager->open( folder => '/path/to/destination/2', create => 1, access => 'rw', ) or die $!; foreach my $msg ( $source_folder->messages() ){ if( $msg->isMultipart() ){ # msg has attachments } if( $msg->subject() =~ m/some_flag/ ){ # do something with msg # $msg->copyTo($destination_1); # or $manager->copyMessage($destination_2, $msg ); } } $manager->closeAllFolders(); 1;

It has great documentation as well!


cp
----
"Never be afraid to try something new. Remember, amateurs built the ark. Professionals built the Titanic."

Replies are listed 'Best First'.
Re: Re: UNIX Mail Box and Mail Parsing
by draconis (Scribe) on May 22, 2003 at 00:13 UTC
    I'm sold ! I didn't look at that module - but you are right - using this will cure my issues and provide the solution that I want to provide.

    Much thanks and I'm very glad to be part of perlmonks.com - I hope that one day - I too will be able to provide such valuable knowledge to those that need it.

    -- draconis

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://259905]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2024-03-28 23:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found