http://qs1969.pair.com?node_id=115910

deprecated has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to rid myself of windows. In order to do that, I need to have an IMAP client. I dislike all the clients out there (dont want to learn mutt, dont like pine's license, not interested in mailsmith, outlook blows, and so on...), so I decided to write my own.

To my pleasant surprise, there is a module to do the work for me, Mail::IMAPClient. So I've drafted up some working code that does what I want it to, mostly, except I get interesting results.

Here is the code:

36 chomp (my $sel = <>); 37 $imap -> select( $folders[$sel] ); 38 my @range = reverse(1..$folderorder{$folders[$sel]}); # 1.. #o +f msgs 39 40 MAILBOX: for my $count (@range) { # newest to oldest 41 #MAILBOX: for my $count (1..$folderorder{$folders[$sel]}) { 42 my $messageno; 43 my ($from, $to, $sub); 44 my @aRef = $imap -> parse_headers( $count, "Subject", "Date" +, "From", "To", "Cc" ) ; 45 if (! $aRef[0]) { 46 next; 47 } 48 print "[ $count ]\n"; 49 foreach my $header (@aRef) { 50 print map { "$_\t: " .$header -> {$_}[0] ."\n" } sort keys + %{ $header }; 51 $from = @{ $header -> {From} }[0]; 52 $to = @{ $header -> {To} }[0]; 53 $sub = @{ $header -> {Subject} }[0]; 54 } 55 if (not $count % 5 ) { 56 print "-- more or selection --> "; 57 chomp ($messageno = <>); 58 print "\n"; 59 goto MENU if $messageno eq qq{q}; 60 dispatch_message( $folders[$sel], $messageno, $from, $to, +$sub ) if $messageno; 61 } 62 }
Unfortunately, it seems that when I tell it to print the oneth message, I "start" about a month ago. At the moment, the oneth message is from Aug 17 (yes, I've gotten at least 400 messages since then), and it looks fine in outlook.

I'm not certain where to go with this as I dont see too many logic errors. I'd rather not hear stylistic critiques as this was something I whipped up on a Saturday morning and is just a prototype.

Has anyone used this module <!- tilly, you need not answer ->? Can anyone see how I might be skipping a few hundred messages?

One other note, if you enter 'imap' in the straight search it goes to some defective node that should be reaped, but I cant seem to submit it for consideration.

Thanks,
brother dep.

--
Laziness, Impatience, Hubris, and Generosity.