in reply to net::pop3 usage
- 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.
|
|---|