CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Webmail Client

 



d1zz13
User

Apr 16, 2002, 8:27 AM

Post #1 of 2 (702 views)
Webmail Client Can't Post

Here's an interesting one for you.

I'm writing a webmail program using Net::POP3.

So far all I've got is very basic code that logs me into the mailbox and lists the number of messages.

Now I want to list the message number and its size. This is meant to be easy as Net::POP3 has a command called LIST that when called without parameters gives a hash reference containing keys (Message ID) and values (Size in octets).

However the following code only seems to return the hash reference.

Code
# Get all messages and their sizes 
%messages = $pop3->list();

# Print a list of messages and their sizes to the browser
print "Content-type: text/plain\n\n";
foreach $msg_id (sort keys %messages){
print "Message ID - $msg_id\n";
print "Message Size - $messages{msg_id}\n\n";
}

All this produces is:

Code
Message ID - HASH(0x8060a1c) 
Message Size -

Any ides on how I can get the keys and values out?

Regards
Richard

Regards
Rich

If it aint broke then don't try to fix it


adrockjames
stranger

Apr 23, 2002, 11:38 AM

Post #2 of 2 (693 views)
Re: [d1zz13] Webmail Client [In reply to] Can't Post

$m = Net::POP3->new('pop.myhost.com');
$n = $m->login('me', 'pass'); # Login, passwd

$r_msgs = $m->list(); # Returns a ref-to-hash mapping

foreach $msg_id (keys %$r_msgs) {
print "Msg $msg_id (" $r_msgs->{$msg_id} ")<br>";

}


$m->quit();

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives