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);
This module implements a client interface to the POP3 protocol, enabling a perl5 application to talk to POP3 servers. This documentation assumes that you are familiar with the POP3 protocol described in RFC1939.
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.
Need some small examples in here :-)
This is the constructor for a new Net::POP3 object. HOST is the name of the remote host to which a POP3 connection is required.
HOST
If HOST is not given, then the POP3_Host specified in Net::Config will be used.
POP3_Host
Net::Config
OPTIONS are passed in a hash like fashion, using key and value pairs. Possible options are:
OPTIONS
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.
Net::POP3
bind
Timeout - Maximum time, in seconds, to wait for a response from the POP3 server (default: 120)
Debug - Enable debugging information
Unless otherwise stated all methods return either a true or false value, with true meaning that the operation was a success. When a method states that it returns a value, failure will be returned as undef or an empty list.
Send the USER command.
Send the PASS command. Returns the number of messages in the mailbox.
Send both the USER and PASS commands. If PASS is not given the Net::POP3 uses Net::Netrc to lookup the password using the host and username. If the username is not specified then the current user name will be used.
PASS
Net::Netrc
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.
"0E0"
If there was an error authenticating the user then undef will be returned.
Authenticate with the server identifying as USER with password PASS. Similar to "login", but the password is not sent in clear text.
USER
To use this method you must have the Digest::MD5 or the MD5 module installed, otherwise this method will return undef.
Get the header and the first NUMLINES of the body for the message MSGNUM. Returns a reference to an array which contains the lines of text read from the server.
NUMLINES
MSGNUM
If called with an argument the list returns the size of the message in octets.
list
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.
Get the message MSGNUM from the remote mailbox. If FH is not given then get returns a reference to an array which contains the lines of text read from the server. If FH is given then the lines returned from the server are printed to the filehandle FH.
FH
As per get(), but returns a tied filehandle. Reading from this filehandle returns the requested message. The filehandle will return EOF at the end of the message and should not be reused.
Returns the highest MSGNUM of all the messages accessed.
Returns a list of two elements. These are the number of undeleted elements and the size of the mbox in octets.
Returns a list of two elements. These are the number of new messages and the total number of messages for USER.
Returns a unique identifier for MSGNUM if given. If MSGNUM is not given uidl returns a reference to a hash where the keys are the message numbers and the values are the unique identifiers.
uidl
Mark message MSGNUM to be deleted from the remote mailbox. All messages that are marked to be deleted will be removed from the remote mailbox when the server connection closed.
Reset the status of the remote POP3 server. This includes reseting the status of all messages to not be deleted.
Quit and close the connection to the remote POP3 server. Any messages marked as deleted will be deleted from the remote mailbox.
If a Net::POP3 object goes out of scope before quit method is called then the reset method will called before the connection is closed. This means that any messages marked to be deleted will not be.
quit
reset
Net::Netrc, Net::Cmd
Graham Barr <gbarr@pobox.com>
Copyright (c) 1995-1997 Graham Barr. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
$Id: //depot/libnet/Net/POP3.pm#22 $
To install if, copy and paste the appropriate command in to your terminal.
cpanm
cpanm if
CPAN shell
perl -MCPAN -e shell install if
For more information on module installation, please visit the detailed CPAN module installation guide.