.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.13)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.ie \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. nr % 0
. rr F
.\}
.el \{\
. de IX
..
.\}
.\" ========================================================================
.\"
.IX Title "Net::POP3 3"
.TH Net::POP3 3 "2017-11-14" "perl v5.10.1" "User Contributed Perl Documentation"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
Net::POP3 \- Post Office Protocol 3 Client class (RFC1939)
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 1
\& use Net::POP3;
\&
\& # Constructors
\& $pop = Net::POP3\->new(\*(Aqpop3host\*(Aq);
\& $pop = Net::POP3\->new(\*(Aqpop3host\*(Aq, Timeout => 60);
\& $pop = Net::POP3\->new(\*(Aqpop3host\*(Aq, SSL => 1, 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;
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
This module implements a client interface to the \s-1POP3\s0 protocol, enabling
a perl5 application to talk to \s-1POP3\s0 servers. This documentation assumes
that you are familiar with the \s-1POP3\s0 protocol described in \s-1RFC1939\s0.
With IO::Socket::SSL installed it also provides support for implicit and
explicit \s-1TLS\s0 encryption, i.e. \s-1POP3S\s0 or \s-1POP3+STARTTLS\s0.
.PP
A new Net::POP3 object must be created with the \fInew\fR method. Once
this has been done, all \s-1POP3\s0 commands are accessed via method calls
on the object.
.PP
The Net::POP3 class is a subclass of Net::Cmd and (depending on avaibility) of
IO::Socket::IP, IO::Socket::INET6 or IO::Socket::INET.
.SH "CONSTRUCTOR"
.IX Header "CONSTRUCTOR"
.IP "new ( [ \s-1HOST\s0 ] [, \s-1OPTIONS\s0 ] )" 4
.IX Item "new ( [ HOST ] [, OPTIONS ] )"
This is the constructor for a new Net::POP3 object. \f(CW\*(C`HOST\*(C'\fR is the
name of the remote host to which an \s-1POP3\s0 connection is required.
.Sp
\&\f(CW\*(C`HOST\*(C'\fR is optional. If \f(CW\*(C`HOST\*(C'\fR is not given then it may instead be
passed as the \f(CW\*(C`Host\*(C'\fR option described below. If neither is given then
the \f(CW\*(C`POP3_Hosts\*(C'\fR specified in \f(CW\*(C`Net::Config\*(C'\fR will be used.
.Sp
\&\f(CW\*(C`OPTIONS\*(C'\fR are passed in a hash like fashion, using key and value pairs.
Possible options are:
.Sp
\&\fBHost\fR \- \s-1POP3\s0 host to connect to. It may be a single scalar, as defined for
the \f(CW\*(C`PeerAddr\*(C'\fR option in IO::Socket::INET, or a reference to
an array with hosts to try in turn. The \*(L"host\*(R" method will return the value
which was used to connect to the host.
.Sp
\&\fBPort\fR \- port to connect to.
Default \- 110 for plain \s-1POP3\s0 and 995 for POP3s (direct \s-1SSL\s0).
.Sp
\&\fB\s-1SSL\s0\fR \- If the connection should be done from start with \s-1SSL\s0, contrary to later
upgrade with \f(CW\*(C`starttls\*(C'\fR.
You can use \s-1SSL\s0 arguments as documented in IO::Socket::SSL, but it will
usually use the right arguments already.
.Sp
\&\fBLocalAddr\fR and \fBLocalPort\fR \- These parameters are passed directly
to IO::Socket to allow binding the socket to a specific local address and port.
For compatibility with older versions \fBResvPort\fR can be used instead of
\&\fBLocalPort\fR.
.Sp
\&\fBDomain\fR \- This parameter is passed directly to IO::Socket and makes it
possible to enforce IPv4 connections even if IO::Socket::IP is used as super
class. Alternatively \fBFamily\fR can be used.
.Sp
\&\fBTimeout\fR \- Maximum time, in seconds, to wait for a response from the
\&\s-1POP3\s0 server (default: 120)
.Sp
\&\fBDebug\fR \- Enable debugging information
.SH "METHODS"
.IX Header "METHODS"
Unless otherwise stated all methods return either a \fItrue\fR or \fIfalse\fR
value, with \fItrue\fR meaning that the operation was a success. When a method
states that it returns a value, failure will be returned as \fIundef\fR or an
empty list.
.PP
\&\f(CW\*(C`Net::POP3\*(C'\fR inherits from \f(CW\*(C`Net::Cmd\*(C'\fR so methods defined in \f(CW\*(C`Net::Cmd\*(C'\fR may
be used to send commands to the remote \s-1POP3\s0 server in addition to the methods
documented here.
.IP "host ()" 4
.IX Item "host ()"
Returns the value used by the constructor, and passed to IO::Socket::INET,
to connect to the host.
.IP "auth ( \s-1USERNAME\s0, \s-1PASSWORD\s0 )" 4
.IX Item "auth ( USERNAME, PASSWORD )"
Attempt \s-1SASL\s0 authentication.
.IP "user ( \s-1USER\s0 )" 4
.IX Item "user ( USER )"
Send the \s-1USER\s0 command.
.IP "pass ( \s-1PASS\s0 )" 4
.IX Item "pass ( PASS )"
Send the \s-1PASS\s0 command. Returns the number of messages in the mailbox.
.IP "login ( [ \s-1USER\s0 [, \s-1PASS\s0 ]] )" 4
.IX Item "login ( [ USER [, PASS ]] )"
Send both the \s-1USER\s0 and \s-1PASS\s0 commands. If \f(CW\*(C`PASS\*(C'\fR is not given the
\&\f(CW\*(C`Net::POP3\*(C'\fR uses \f(CW\*(C`Net::Netrc\*(C'\fR to lookup the password using the host
and username. If the username is not specified then the current user name
will be used.
.Sp
Returns the number of messages in the mailbox. However if there are no
messages on the server the string \f(CW"0E0"\fR will be returned. This is
will give a true value in a boolean context, but zero in a numeric context.
.Sp
If there was an error authenticating the user then \fIundef\fR will be returned.
.IP "starttls ( \s-1SSLARGS\s0 )" 4
.IX Item "starttls ( SSLARGS )"
Upgrade existing plain connection to \s-1SSL\s0.
You can use \s-1SSL\s0 arguments as documented in IO::Socket::SSL, but it will
usually use the right arguments already.
.IP "apop ( [ \s-1USER\s0 [, \s-1PASS\s0 ]] )" 4
.IX Item "apop ( [ USER [, PASS ]] )"
Authenticate with the server identifying as \f(CW\*(C`USER\*(C'\fR with password \f(CW\*(C`PASS\*(C'\fR.
Similar to \*(L"login\*(R", but the password is not sent in clear text.
.Sp
To use this method you must have the Digest::MD5 or the \s-1MD5\s0 module installed,
otherwise this method will return \fIundef\fR.
.IP "banner ()" 4
.IX Item "banner ()"
Return the sever's connection banner
.IP "capa ()" 4
.IX Item "capa ()"
Return a reference to a hash of the capabilities of the server. \s-1APOP\s0
is added as a pseudo capability. Note that I've been unable to
find a list of the standard capability values, and some appear to
be multi-word and some are not. We make an attempt at intelligently
parsing them, but it may not be correct.
.IP "capabilities ()" 4
.IX Item "capabilities ()"
Just like capa, but only uses a cache from the last time we asked
the server, so as to avoid asking more than once.
.IP "top ( \s-1MSGNUM\s0 [, \s-1NUMLINES\s0 ] )" 4
.IX Item "top ( MSGNUM [, NUMLINES ] )"
Get the header and the first \f(CW\*(C`NUMLINES\*(C'\fR of the body for the message
\&\f(CW\*(C`MSGNUM\*(C'\fR. Returns a reference to an array which contains the lines of text
read from the server.
.IP "list ( [ \s-1MSGNUM\s0 ] )" 4
.IX Item "list ( [ MSGNUM ] )"
If called with an argument the \f(CW\*(C`list\*(C'\fR returns the size of the message
in octets.
.Sp
If called without arguments a reference to a hash is returned. The
keys will be the \f(CW\*(C`MSGNUM\*(C'\fR's of all undeleted messages and the values will
be their size in octets.
.IP "get ( \s-1MSGNUM\s0 [, \s-1FH\s0 ] )" 4
.IX Item "get ( MSGNUM [, FH ] )"
Get the message \f(CW\*(C`MSGNUM\*(C'\fR from the remote mailbox. If \f(CW\*(C`FH\*(C'\fR is not given
then get returns a reference to an array which contains the lines of
text read from the server. If \f(CW\*(C`FH\*(C'\fR is given then the lines returned
from the server are printed to the filehandle \f(CW\*(C`FH\*(C'\fR.
.IP "getfh ( \s-1MSGNUM\s0 )" 4
.IX Item "getfh ( MSGNUM )"
As per \fIget()\fR, but returns a tied filehandle. Reading from this
filehandle returns the requested message. The filehandle will return
\&\s-1EOF\s0 at the end of the message and should not be reused.
.IP "last ()" 4
.IX Item "last ()"
Returns the highest \f(CW\*(C`MSGNUM\*(C'\fR of all the messages accessed.
.IP "popstat ()" 4
.IX Item "popstat ()"
Returns a list of two elements. These are the number of undeleted
elements and the size of the mbox in octets.
.IP "ping ( \s-1USER\s0 )" 4
.IX Item "ping ( USER )"
Returns a list of two elements. These are the number of new messages
and the total number of messages for \f(CW\*(C`USER\*(C'\fR.
.IP "uidl ( [ \s-1MSGNUM\s0 ] )" 4
.IX Item "uidl ( [ MSGNUM ] )"
Returns a unique identifier for \f(CW\*(C`MSGNUM\*(C'\fR if given. If \f(CW\*(C`MSGNUM\*(C'\fR is not
given \f(CW\*(C`uidl\*(C'\fR returns a reference to a hash where the keys are the
message numbers and the values are the unique identifiers.
.IP "delete ( \s-1MSGNUM\s0 )" 4
.IX Item "delete ( MSGNUM )"
Mark message \f(CW\*(C`MSGNUM\*(C'\fR 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.
.IP "reset ()" 4
.IX Item "reset ()"
Reset the status of the remote \s-1POP3\s0 server. This includes resetting the
status of all messages to not be deleted.
.IP "quit ()" 4
.IX Item "quit ()"
Quit and close the connection to the remote \s-1POP3\s0 server. Any messages marked
as deleted will be deleted from the remote mailbox.
.IP "can_inet6 ()" 4
.IX Item "can_inet6 ()"
Returns whether we can use IPv6.
.IP "can_ssl ()" 4
.IX Item "can_ssl ()"
Returns whether we can use \s-1SSL\s0.
.SH "NOTES"
.IX Header "NOTES"
If a \f(CW\*(C`Net::POP3\*(C'\fR object goes out of scope before \f(CW\*(C`quit\*(C'\fR method is called
then the \f(CW\*(C`reset\*(C'\fR method will called before the connection is closed. This
means that any messages marked to be deleted will not be.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
Net::Netrc,
Net::Cmd,
IO::Socket::SSL
.SH "AUTHOR"
.IX Header "AUTHOR"
Graham Barr <\fIgbarr@pobox.com\fR>.
.PP
Steve Hay <\fIshay@cpan.org\fR> is now maintaining libnet as of version
1.22_02.
.SH "COPYRIGHT"
.IX Header "COPYRIGHT"
Copyright (C) 1995\-2004 Graham Barr. All rights reserved.
.PP
Copyright (C) 2013\-2016 Steve Hay. All rights reserved.
.SH "LICENCE"
.IX Header "LICENCE"
This module is free software; you can redistribute it and/or modify it under the
same terms as Perl itself, i.e. under the terms of either the \s-1GNU\s0 General Public
License or the Artistic License, as specified in the \fI\s-1LICENCE\s0\fR file.
Copyright 2K16 - 2K18 Indonesian Hacker Rulez