Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Downloading IMAP Folders to mbox file

by TilRMan (Friar)
on Jun 19, 2006 at 06:17 UTC ( #556192=note: print w/ replies, xml ) Need Help??


in reply to Downloading IMAP Folders to mbox file

You probably need to supply some arguments to formail -- perhaps some of -Yeds -- to help it figure out where your messages start and stop. However, formail can't promise to get it 100% right, so you'll end up with mutilated and merged messages.

If you were as paranoid as I am, you would run each message through formail and concatenate the output into a single file; that file would be a valid mbox. This will take a long time for many messages; but if you are running this regularly it should be tolerable.

# Untested foreach my $flavor qw( SPAM HAM ) { my $file = "/home/mail/mbox/${flavor}.mbox"; $imap->select($flavor); my @msgs = $imap->search("ALL"); foreach my $msg (@msgs) { open my $pipe, "| formail >> $file" or die "$!"; $imap->message_to_file($pipe, $msg); close $pipe or die "$!"; $imap->delete_message($msg); } }


Comment on Re: Downloading IMAP Folders to mbox file
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2015-07-30 01:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (269 votes), past polls