.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.20)
.\"
.\" 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
..
.\}
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
.    \" fudge factors for nroff and troff
.if n \{\
.    ds #H 0
.    ds #V .8m
.    ds #F .3m
.    ds #[ \f1
.    ds #] \fP
.\}
.if t \{\
.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
.    ds #V .6m
.    ds #F 0
.    ds #[ \&
.    ds #] \&
.\}
.    \" simple accents for nroff and troff
.if n \{\
.    ds ' \&
.    ds ` \&
.    ds ^ \&
.    ds , \&
.    ds ~ ~
.    ds /
.\}
.if t \{\
.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
.    \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
.    \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
.    \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
.    ds : e
.    ds 8 ss
.    ds o a
.    ds d- d\h'-1'\(ga
.    ds D- D\h'-1'\(hy
.    ds th \o'bp'
.    ds Th \o'LP'
.    ds ae ae
.    ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "Net::POP3 3pm"
.TH Net::POP3 3pm "2013-02-26" "perl v5.16.3" "Perl Programmers Reference Guide"
.\" 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);
\&
\&    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.
.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.
.SH "CONSTRUCTOR"
.IX Header "CONSTRUCTOR"
.IP "new ( [ \s-1HOST\s0 ] [, \s-1OPTIONS\s0 ] 0" 4
.IX Item "new ( [ HOST ] [, OPTIONS ] 0"
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
\&\fBResvPort\fR \- If given then the socket for the \f(CW\*(C`Net::POP3\*(C'\fR object
will be bound to the local port given using \f(CW\*(C`bind\*(C'\fR when the socket is
created.
.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.
.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 "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.
.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
.SH "AUTHOR"
.IX Header "AUTHOR"
Graham Barr <gbarr@pobox.com>
.SH "COPYRIGHT"
.IX Header "COPYRIGHT"
Copyright (c) 1995\-2003 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.
