Net::POP3 - Post Office Protocol 3 Client class (RFC1939)
use Net::POP3;
# Constructors $pop = Net::POP3->new('pop3host'); $pop = Net::POP3->new('pop3host', Timeout => 60);
if ($pop->login($username, $password) > 0) { my $msgnums = $pop->list; # hashref of msgnum => size foreach my $msgnum (keys %$msgnums) { my $msg = $pop->get($msgnum); print @$msg; $pop->delete($msgnum); } }
$pop->quit;
A new Net::POP3 object must be created with the new method. Once this has been done, all POP3 commands are accessed via method calls on the object.
"HOST" is optional. If "HOST" is not given then it may instead be passed as the "Host" option described below. If neither is given then the "POP3_Hosts" specified in "Net::Config" will be used.
"OPTIONS" are passed in a hash like fashion, using key and value pairs. Possible options are:
Host - POP3 host to connect to. It may be a single scalar, as defined for the "PeerAddr" option in IO::Socket::INET, or a reference to an array with hosts to try in turn. The ``host'' method will return the value which was used to connect to the host.
ResvPort - If given then the socket for the "Net::POP3" object will be bound to the local port given using "bind" when the socket is created.
Timeout - Maximum time, in seconds, to wait for a response from the POP3 server (default: 120)
Debug - Enable debugging information
Returns the number of messages in the mailbox. However if there are no messages on the server the string "0E0" will be returned. This is will give a true value in a boolean context, but zero in a numeric context.
If there was an error authenticating the user then undef will be returned.
To use this method you must have the Digest::MD5 or the MD5 module installed, otherwise this method will return undef.
If called without arguments a reference to a hash is returned. The keys will be the "MSGNUM"'s of all undeleted messages and the values will be their size in octets.
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |