Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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.


In reply to Using Mail::IMAPClient (code) by deprecated

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (5)
As of 2024-04-18 21:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found