Here's my understanding.

- As stated previously $pop->last() returns the last message number that <bold>you<bold> previously accessed. If you haven't downloaded any messages yet, it will return 0. If you have downloaded messages from the current set and it still returns 0 then maybe your POP3 server is not configured correctly.
- in my use of $pop->top(), I needed to add the number of additional lines past the header to grab. This seemed to be more of a 'function' of my POP3 server. You can test this out by doing the commands manually.
Like this:
Telnet popserver 110
user username
pass password
top msg# --- this did not work for me
top msg# 0 --- this showed me the message headers for msg#

while you are there, try the list and last commands.
quit --- end your session

ok, now for my code that worked against yahoo's POP servers

#!d:\perl\bin\perl -w use Net::POP3; use strict; my $host = 'popserver'; my $mailbox = 'username'; my $password = 'password'; my ($item,$message,$line); my $pop = Net::POP3->new($host) or die "$!\n"; $pop->login($mailbox,$password) or die "$!\n"; my $message_list = $pop->list; foreach $item (keys %$message_list) { my $message = $pop->top($item, 0); foreach $line (@$message){ print "$item = $line"; } }

Hope this helps.


In reply to Re: net::pop3 usage by dmistretta
in thread net::pop3 usage by LiTinOveWeedle

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.