<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;"># Net::POP3.pm
#
# Copyright (C) 1995-2004 Graham Barr.  All rights reserved.
# Copyright (C) 2013-2016 Steve Hay.  All rights reserved.
# 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 GNU General
# Public License or the Artistic License, as specified in the F&lt;LICENCE&gt; file.

package Net::POP3;

use 5.008001;

use strict;
use warnings;

use Carp;
use IO::Socket;
use Net::Cmd;
use Net::Config;

our $VERSION = "3.11";

# Code for detecting if we can use SSL
my $ssl_class = eval {
  require IO::Socket::SSL;
  # first version with default CA on most platforms
  no warnings 'numeric';
  IO::Socket::SSL-&gt;VERSION(2.007);
} &amp;&amp; 'IO::Socket::SSL';

my $nossl_warn = !$ssl_class &amp;&amp;
  'To use SSL please install IO::Socket::SSL with version&gt;=2.007';

# Code for detecting if we can use IPv6
my $family_key = 'Domain';
my $inet6_class = eval {
  require IO::Socket::IP;
  no warnings 'numeric';
  IO::Socket::IP-&gt;VERSION(0.25) || die;
  $family_key = 'Family';
} &amp;&amp; 'IO::Socket::IP' || eval {
  require IO::Socket::INET6;
  no warnings 'numeric';
  IO::Socket::INET6-&gt;VERSION(2.62);
} &amp;&amp; 'IO::Socket::INET6';


sub can_ssl   { $ssl_class };
sub can_inet6 { $inet6_class };

our @ISA = ('Net::Cmd', $inet6_class || 'IO::Socket::INET');

sub new {
  my $self = shift;
  my $type = ref($self) || $self;
  my ($host, %arg);
  if (@_ % 2) {
    $host = shift;
    %arg  = @_;
  }
  else {
    %arg  = @_;
    $host = delete $arg{Host};
  }
  my $hosts = defined $host ? [$host] : $NetConfig{pop3_hosts};
  my $obj;

  if ($arg{SSL}) {
    # SSL from start
    die $nossl_warn if !$ssl_class;
    $arg{Port} ||= 995;
  }

  $arg{Timeout} = 120 if ! defined $arg{Timeout};

  foreach my $h (@{$hosts}) {
    $obj = $type-&gt;SUPER::new(
      PeerAddr =&gt; ($host = $h),
      PeerPort =&gt; $arg{Port} || 'pop3(110)',
      Proto =&gt; 'tcp',
      $family_key =&gt; $arg{Domain} || $arg{Family},
      LocalAddr =&gt; $arg{LocalAddr},
      LocalPort =&gt; exists($arg{ResvPort}) ? $arg{ResvPort} : $arg{LocalPort},
      Timeout =&gt; $arg{Timeout},
      )
      and last;
  }

  return
    unless defined $obj;

  ${*$obj}{'net_pop3_arg'} = \%arg;
  ${*$obj}{'net_pop3_host'} = $host;
  if ($arg{SSL}) {
    Net::POP3::_SSL-&gt;start_SSL($obj,%arg) or return;
  }

  $obj-&gt;autoflush(1);
  $obj-&gt;debug(exists $arg{Debug} ? $arg{Debug} : undef);

  unless ($obj-&gt;response() == CMD_OK) {
    $obj-&gt;close();
    return;
  }

  ${*$obj}{'net_pop3_banner'} = $obj-&gt;message;

  $obj;
}


sub host {
  my $me = shift;
  ${*$me}{'net_pop3_host'};
}

##
## We don't want people sending me their passwords when they report problems
## now do we :-)
##


sub debug_text { $_[2] =~ /^(pass|rpop)/i ? "$1 ....\n" : $_[2]; }


sub login {
  @_ &gt;= 1 &amp;&amp; @_ &lt;= 3 or croak 'usage: $pop3-&gt;login( USER, PASS )';
  my ($me, $user, $pass) = @_;

  if (@_ &lt;= 2) {
    ($user, $pass) = $me-&gt;_lookup_credentials($user);
  }

  $me-&gt;user($user)
    and $me-&gt;pass($pass);
}

sub starttls {
  my $self = shift;
  $ssl_class or die $nossl_warn;
  $self-&gt;_STLS or return;
  Net::POP3::_SSL-&gt;start_SSL($self,
    %{ ${*$self}{'net_pop3_arg'} }, # (ssl) args given in new
    @_   # more (ssl) args
  ) or return;
  return 1;
}

sub apop {
  @_ &gt;= 1 &amp;&amp; @_ &lt;= 3 or croak 'usage: $pop3-&gt;apop( USER, PASS )';
  my ($me, $user, $pass) = @_;
  my $banner;
  my $md;

  if (eval { local $SIG{__DIE__}; require Digest::MD5 }) {
    $md = Digest::MD5-&gt;new();
  }
  elsif (eval { local $SIG{__DIE__}; require MD5 }) {
    $md = MD5-&gt;new();
  }
  else {
    carp "You need to install Digest::MD5 or MD5 to use the APOP command";
    return;
  }

  return
    unless ($banner = (${*$me}{'net_pop3_banner'} =~ /(&lt;.*&gt;)/)[0]);

  if (@_ &lt;= 2) {
    ($user, $pass) = $me-&gt;_lookup_credentials($user);
  }

  $md-&gt;add($banner, $pass);

  return
    unless ($me-&gt;_APOP($user, $md-&gt;hexdigest));

  $me-&gt;_get_mailbox_count();
}


sub user {
  @_ == 2 or croak 'usage: $pop3-&gt;user( USER )';
  $_[0]-&gt;_USER($_[1]) ? 1 : undef;
}


sub pass {
  @_ == 2 or croak 'usage: $pop3-&gt;pass( PASS )';

  my ($me, $pass) = @_;

  return
    unless ($me-&gt;_PASS($pass));

  $me-&gt;_get_mailbox_count();
}


sub reset {
  @_ == 1 or croak 'usage: $obj-&gt;reset()';

  my $me = shift;

  return 0
    unless ($me-&gt;_RSET);

  if (defined ${*$me}{'net_pop3_mail'}) {
    local $_;
    foreach (@{${*$me}{'net_pop3_mail'}}) {
      delete $_-&gt;{'net_pop3_deleted'};
    }
  }
}


sub last {
  @_ == 1 or croak 'usage: $obj-&gt;last()';

  return
    unless $_[0]-&gt;_LAST &amp;&amp; $_[0]-&gt;message =~ /(\d+)/;

  return $1;
}


sub top {
  @_ == 2 || @_ == 3 or croak 'usage: $pop3-&gt;top( MSGNUM [, NUMLINES ])';
  my $me = shift;

  return
    unless $me-&gt;_TOP($_[0], $_[1] || 0);

  $me-&gt;read_until_dot;
}


sub popstat {
  @_ == 1 or croak 'usage: $pop3-&gt;popstat()';
  my $me = shift;

  return ()
    unless $me-&gt;_STAT &amp;&amp; $me-&gt;message =~ /(\d+)\D+(\d+)/;

  ($1 || 0, $2 || 0);
}


sub list {
  @_ == 1 || @_ == 2 or croak 'usage: $pop3-&gt;list( [ MSGNUM ] )';
  my $me = shift;

  return
    unless $me-&gt;_LIST(@_);

  if (@_) {
    $me-&gt;message =~ /\d+\D+(\d+)/;
    return $1 || undef;
  }

  my $info = $me-&gt;read_until_dot
    or return;

  my %hash = map { (/(\d+)\D+(\d+)/) } @$info;

  return \%hash;
}


sub get {
  @_ == 2 or @_ == 3 or croak 'usage: $pop3-&gt;get( MSGNUM [, FH ])';
  my $me = shift;

  return
    unless $me-&gt;_RETR(shift);

  $me-&gt;read_until_dot(@_);
}


sub getfh {
  @_ == 2 or croak 'usage: $pop3-&gt;getfh( MSGNUM )';
  my $me = shift;

  return unless $me-&gt;_RETR(shift);
  return $me-&gt;tied_fh;
}


sub delete {
  @_ == 2 or croak 'usage: $pop3-&gt;delete( MSGNUM )';
  my $me = shift;
  return 0 unless $me-&gt;_DELE(@_);
  ${*$me}{'net_pop3_deleted'} = 1;
}


sub uidl {
  @_ == 1 || @_ == 2 or croak 'usage: $pop3-&gt;uidl( [ MSGNUM ] )';
  my $me = shift;
  my $uidl;

  $me-&gt;_UIDL(@_)
    or return;
  if (@_) {
    $uidl = ($me-&gt;message =~ /\d+\s+([\041-\176]+)/)[0];
  }
  else {
    my $ref = $me-&gt;read_until_dot
      or return;
    $uidl = {};
    foreach my $ln (@$ref) {
      my ($msg, $uid) = $ln =~ /^\s*(\d+)\s+([\041-\176]+)/;
      $uidl-&gt;{$msg} = $uid;
    }
  }
  return $uidl;
}


sub ping {
  @_ == 2 or croak 'usage: $pop3-&gt;ping( USER )';
  my $me = shift;

  return () unless $me-&gt;_PING(@_) &amp;&amp; $me-&gt;message =~ /(\d+)\D+(\d+)/;

  ($1 || 0, $2 || 0);
}


sub _lookup_credentials {
  my ($me, $user) = @_;

  require Net::Netrc;

       $user ||= eval { local $SIG{__DIE__}; (getpwuid($&gt;))[0] }
    || $ENV{NAME}
    || $ENV{USER}
    || $ENV{LOGNAME};

  my $m = Net::Netrc-&gt;lookup(${*$me}{'net_pop3_host'}, $user);
  $m ||= Net::Netrc-&gt;lookup(${*$me}{'net_pop3_host'});

  my $pass = $m
    ? $m-&gt;password || ""
    : "";

  ($user, $pass);
}


sub _get_mailbox_count {
  my ($me) = @_;
  my $ret = ${*$me}{'net_pop3_count'} =
    ($me-&gt;message =~ /(\d+)\s+message/io) ? $1 : ($me-&gt;popstat)[0];

  $ret ? $ret : "0E0";
}


sub _STAT { shift-&gt;command('STAT'       )-&gt;response() == CMD_OK }
sub _LIST { shift-&gt;command('LIST',    @_)-&gt;response() == CMD_OK }
sub _RETR { shift-&gt;command('RETR', $_[0])-&gt;response() == CMD_OK }
sub _DELE { shift-&gt;command('DELE', $_[0])-&gt;response() == CMD_OK }
sub _NOOP { shift-&gt;command('NOOP'       )-&gt;response() == CMD_OK }
sub _RSET { shift-&gt;command('RSET'       )-&gt;response() == CMD_OK }
sub _QUIT { shift-&gt;command('QUIT'       )-&gt;response() == CMD_OK }
sub _TOP  { shift-&gt;command( 'TOP',    @_)-&gt;response() == CMD_OK }
sub _UIDL { shift-&gt;command('UIDL',    @_)-&gt;response() == CMD_OK }
sub _USER { shift-&gt;command('USER', $_[0])-&gt;response() == CMD_OK }
sub _PASS { shift-&gt;command('PASS', $_[0])-&gt;response() == CMD_OK }
sub _APOP { shift-&gt;command('APOP',    @_)-&gt;response() == CMD_OK }
sub _PING { shift-&gt;command('PING', $_[0])-&gt;response() == CMD_OK }
sub _RPOP { shift-&gt;command('RPOP', $_[0])-&gt;response() == CMD_OK }
sub _LAST { shift-&gt;command('LAST'       )-&gt;response() == CMD_OK }
sub _CAPA { shift-&gt;command('CAPA'       )-&gt;response() == CMD_OK }
sub _STLS { shift-&gt;command("STLS",     )-&gt;response() == CMD_OK }


sub quit {
  my $me = shift;

  $me-&gt;_QUIT;
  $me-&gt;close;
}


sub DESTROY {
  my $me = shift;

  if (defined fileno($me) and ${*$me}{'net_pop3_deleted'}) {
    $me-&gt;reset;
    $me-&gt;quit;
  }
}

##
## POP3 has weird responses, so we emulate them to look the same :-)
##


sub response {
  my $cmd  = shift;
  my $str  = $cmd-&gt;getline() or return;
  my $code = "500";

  $cmd-&gt;debug_print(0, $str)
    if ($cmd-&gt;debug);

  if ($str =~ s/^\+OK\s*//io) {
    $code = "200";
  }
  elsif ($str =~ s/^\+\s*//io) {
    $code = "300";
  }
  else {
    $str =~ s/^-ERR\s*//io;
  }

  ${*$cmd}{'net_cmd_resp'} = [$str];
  ${*$cmd}{'net_cmd_code'} = $code;

  substr($code, 0, 1);
}


sub capa {
  my $this = shift;
  my ($capa, %capabilities);

  # Fake a capability here
  $capabilities{APOP} = '' if ($this-&gt;banner() =~ /&lt;.*&gt;/);

  if ($this-&gt;_CAPA()) {
    $capabilities{CAPA} = 1;
    $capa = $this-&gt;read_until_dot();
    %capabilities = (%capabilities, map {/^\s*(\S+)\s*(.*)/} @$capa);
  }
  else {

    # Check AUTH for SASL capabilities
    if ($this-&gt;command('AUTH')-&gt;response() == CMD_OK) {
      my $mechanism = $this-&gt;read_until_dot();
      $capabilities{SASL} = join " ", map {m/([A-Z0-9_-]+)/} @{$mechanism};
    }
  }

  return ${*$this}{'net_pop3e_capabilities'} = \%capabilities;
}


sub capabilities {
  my $this = shift;

  ${*$this}{'net_pop3e_capabilities'} || $this-&gt;capa;
}


sub auth {
  my ($self, $username, $password) = @_;

  eval {
    require MIME::Base64;
    require Authen::SASL;
  } or $self-&gt;set_status(500, ["Need MIME::Base64 and Authen::SASL todo auth"]), return 0;

  my $capa       = $self-&gt;capa;
  my $mechanisms = $capa-&gt;{SASL} || 'CRAM-MD5';

  my $sasl;

  if (ref($username) and UNIVERSAL::isa($username, 'Authen::SASL')) {
    $sasl = $username;
    my $user_mech = $sasl-&gt;mechanism || '';
    my @user_mech = split(/\s+/, $user_mech);
    my %user_mech;
    @user_mech{@user_mech} = ();

    my @server_mech = split(/\s+/, $mechanisms);
    my @mech = @user_mech
      ? grep { exists $user_mech{$_} } @server_mech
      : @server_mech;
    unless (@mech) {
      $self-&gt;set_status(
        500,
        [ 'Client SASL mechanisms (',
          join(', ', @user_mech),
          ') do not match the SASL mechnism the server announces (',
          join(', ', @server_mech), ')',
        ]
      );
      return 0;
    }

    $sasl-&gt;mechanism(join(" ", @mech));
  }
  else {
    die "auth(username, password)" if not length $username;
    $sasl = Authen::SASL-&gt;new(
      mechanism =&gt; $mechanisms,
      callback  =&gt; {
        user     =&gt; $username,
        pass     =&gt; $password,
        authname =&gt; $username,
      }
    );
  }

  # We should probably allow the user to pass the host, but I don't
  # currently know and SASL mechanisms that are used by smtp that need it
  my ($hostname) = split /:/, ${*$self}{'net_pop3_host'};
  my $client = eval { $sasl-&gt;client_new('pop', $hostname, 0) };

  unless ($client) {
    my $mech = $sasl-&gt;mechanism;
    $self-&gt;set_status(
      500,
      [ " Authen::SASL failure: $@",
        '(please check if your local Authen::SASL installation',
        "supports mechanism '$mech'"
      ]
    );
    return 0;
  }

  my ($token) = $client-&gt;client_start
    or do {
    my $mech = $client-&gt;mechanism;
    $self-&gt;set_status(
      500,
      [ ' Authen::SASL failure:  $client-&gt;client_start ',
        "mechanism '$mech' hostname #$hostname#",
        $client-&gt;error
      ]
    );
    return 0;
    };

  # We don't support sasl mechanisms that encrypt the socket traffic.
  # todo that we would really need to change the ISA hierarchy
  # so we don't inherit from IO::Socket, but instead hold it in an attribute

  my @cmd = ("AUTH", $client-&gt;mechanism);
  my $code;

  push @cmd, MIME::Base64::encode_base64($token, '')
    if defined $token and length $token;

  while (($code = $self-&gt;command(@cmd)-&gt;response()) == CMD_MORE) {

    my ($token) = $client-&gt;client_step(MIME::Base64::decode_base64(($self-&gt;message)[0])) or do {
      $self-&gt;set_status(
        500,
        [ ' Authen::SASL failure:  $client-&gt;client_step ',
          "mechanism '", $client-&gt;mechanism, " hostname #$hostname#, ",
          $client-&gt;error
        ]
      );
      return 0;
    };

    @cmd = (MIME::Base64::encode_base64(defined $token ? $token : '', ''));
  }

  $code == CMD_OK;
}


sub banner {
  my $this = shift;

  return ${*$this}{'net_pop3_banner'};
}

{
  package Net::POP3::_SSL;
  our @ISA = ( $ssl_class ? ($ssl_class):(), 'Net::POP3' );
  sub starttls { die "POP3 connection is already in SSL mode" }
  sub start_SSL {
    my ($class,$pop3,%arg) = @_;
    delete @arg{ grep { !m{^SSL_} } keys %arg };
    ( $arg{SSL_verifycn_name} ||= $pop3-&gt;host )
        =~s{(?&lt;!:):[\w()]+$}{}; # strip port
    $arg{SSL_hostname} = $arg{SSL_verifycn_name}
        if ! defined $arg{SSL_hostname} &amp;&amp; $class-&gt;can_client_sni;
    $arg{SSL_verifycn_scheme} ||= 'pop3';
    my $ok = $class-&gt;SUPER::start_SSL($pop3,%arg);
    $@ = $ssl_class-&gt;errstr if !$ok;
    return $ok;
  }
}



1;

__END__

=head1 NAME

Net::POP3 - Post Office Protocol 3 Client class (RFC1939)

=head1 SYNOPSIS

    use Net::POP3;

    # Constructors
    $pop = Net::POP3-&gt;new('pop3host');
    $pop = Net::POP3-&gt;new('pop3host', Timeout =&gt; 60);
    $pop = Net::POP3-&gt;new('pop3host', SSL =&gt; 1, Timeout =&gt; 60);

    if ($pop-&gt;login($username, $password) &gt; 0) {
      my $msgnums = $pop-&gt;list; # hashref of msgnum =&gt; size
      foreach my $msgnum (keys %$msgnums) {
        my $msg = $pop-&gt;get($msgnum);
        print @$msg;
        $pop-&gt;delete($msgnum);
      }
    }

    $pop-&gt;quit;

=head1 DESCRIPTION

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.
With L&lt;IO::Socket::SSL&gt; installed it also provides support for implicit and
explicit TLS encryption, i.e. POP3S or POP3+STARTTLS.

A new Net::POP3 object must be created with the I&lt;new&gt; method. Once
this has been done, all POP3 commands are accessed via method calls
on the object.

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.


=head1 CONSTRUCTOR

=over 4

=item new ( [ HOST ] [, OPTIONS ] )

This is the constructor for a new Net::POP3 object. C&lt;HOST&gt; is the
name of the remote host to which an POP3 connection is required.

C&lt;HOST&gt; is optional. If C&lt;HOST&gt; is not given then it may instead be
passed as the C&lt;Host&gt; option described below. If neither is given then
the C&lt;POP3_Hosts&gt; specified in C&lt;Net::Config&gt; will be used.

C&lt;OPTIONS&gt; are passed in a hash like fashion, using key and value pairs.
Possible options are:

B&lt;Host&gt; - POP3 host to connect to. It may be a single scalar, as defined for
the C&lt;PeerAddr&gt; option in L&lt;IO::Socket::INET&gt;, or a reference to
an array with hosts to try in turn. The L&lt;/host&gt; method will return the value
which was used to connect to the host.

B&lt;Port&gt; - port to connect to.
Default - 110 for plain POP3 and 995 for POP3s (direct SSL).

B&lt;SSL&gt; - If the connection should be done from start with SSL, contrary to later
upgrade with C&lt;starttls&gt;.
You can use SSL arguments as documented in L&lt;IO::Socket::SSL&gt;, but it will
usually use the right arguments already.

B&lt;LocalAddr&gt; and B&lt;LocalPort&gt; - 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 B&lt;ResvPort&gt; can be used instead of
B&lt;LocalPort&gt;.

B&lt;Domain&gt; - This parameter is passed directly to IO::Socket and makes it
possible to enforce IPv4 connections even if L&lt;IO::Socket::IP&gt; is used as super
class. Alternatively B&lt;Family&gt; can be used.

B&lt;Timeout&gt; - Maximum time, in seconds, to wait for a response from the
POP3 server (default: 120)

B&lt;Debug&gt; - Enable debugging information

=back

=head1 METHODS

Unless otherwise stated all methods return either a I&lt;true&gt; or I&lt;false&gt;
value, with I&lt;true&gt; meaning that the operation was a success. When a method
states that it returns a value, failure will be returned as I&lt;undef&gt; or an
empty list.

C&lt;Net::POP3&gt; inherits from C&lt;Net::Cmd&gt; so methods defined in C&lt;Net::Cmd&gt; may
be used to send commands to the remote POP3 server in addition to the methods
documented here.

=over 4

=item host ()

Returns the value used by the constructor, and passed to IO::Socket::INET,
to connect to the host.

=item auth ( USERNAME, PASSWORD )

Attempt SASL authentication.

=item user ( USER )

Send the USER command.

=item pass ( PASS )

Send the PASS command. Returns the number of messages in the mailbox.

=item login ( [ USER [, PASS ]] )

Send both the USER and PASS commands. If C&lt;PASS&gt; is not given the
C&lt;Net::POP3&gt; uses C&lt;Net::Netrc&gt; to lookup the password using the host
and username. If the username is not specified then the current user name
will be used.

Returns the number of messages in the mailbox. However if there are no
messages on the server the string C&lt;"0E0"&gt; 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 I&lt;undef&gt; will be returned.

=item starttls ( SSLARGS )

Upgrade existing plain connection to SSL.
You can use SSL arguments as documented in L&lt;IO::Socket::SSL&gt;, but it will
usually use the right arguments already.

=item apop ( [ USER [, PASS ]] )

Authenticate with the server identifying as C&lt;USER&gt; with password C&lt;PASS&gt;.
Similar to L&lt;/login&gt;, but the password is not sent in clear text.

To use this method you must have the Digest::MD5 or the MD5 module installed,
otherwise this method will return I&lt;undef&gt;.

=item banner ()

Return the sever's connection banner

=item capa ()

Return a reference to a hash of the capabilities of the server.  APOP
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.

=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.

=item top ( MSGNUM [, NUMLINES ] )

Get the header and the first C&lt;NUMLINES&gt; of the body for the message
C&lt;MSGNUM&gt;. Returns a reference to an array which contains the lines of text
read from the server.

=item list ( [ MSGNUM ] )

If called with an argument the C&lt;list&gt; returns the size of the message
in octets.

If called without arguments a reference to a hash is returned. The
keys will be the C&lt;MSGNUM&gt;'s of all undeleted messages and the values will
be their size in octets.

=item get ( MSGNUM [, FH ] )

Get the message C&lt;MSGNUM&gt; from the remote mailbox. If C&lt;FH&gt; is not given
then get returns a reference to an array which contains the lines of
text read from the server. If C&lt;FH&gt; is given then the lines returned
from the server are printed to the filehandle C&lt;FH&gt;.

=item getfh ( MSGNUM )

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.

=item last ()

Returns the highest C&lt;MSGNUM&gt; of all the messages accessed.

=item popstat ()

Returns a list of two elements. These are the number of undeleted
elements and the size of the mbox in octets.

=item ping ( USER )

Returns a list of two elements. These are the number of new messages
and the total number of messages for C&lt;USER&gt;.

=item uidl ( [ MSGNUM ] )

Returns a unique identifier for C&lt;MSGNUM&gt; if given. If C&lt;MSGNUM&gt; is not
given C&lt;uidl&gt; returns a reference to a hash where the keys are the
message numbers and the values are the unique identifiers.

=item delete ( MSGNUM )

Mark message C&lt;MSGNUM&gt; 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.

=item reset ()

Reset the status of the remote POP3 server. This includes resetting the
status of all messages to not be deleted.

=item quit ()

Quit and close the connection to the remote POP3 server. Any messages marked
as deleted will be deleted from the remote mailbox.

=item can_inet6 ()

Returns whether we can use IPv6.

=item can_ssl ()

Returns whether we can use SSL.

=back

=head1 NOTES

If a C&lt;Net::POP3&gt; object goes out of scope before C&lt;quit&gt; method is called
then the C&lt;reset&gt; method will called before the connection is closed. This
means that any messages marked to be deleted will not be.

=head1 SEE ALSO

L&lt;Net::Netrc&gt;,
L&lt;Net::Cmd&gt;,
L&lt;IO::Socket::SSL&gt;

=head1 AUTHOR

Graham Barr E&lt;lt&gt;F&lt;gbarr@pobox.com&gt;E&lt;gt&gt;.

Steve Hay E&lt;lt&gt;F&lt;shay@cpan.org&gt;E&lt;gt&gt; is now maintaining libnet as of version
1.22_02.

=head1 COPYRIGHT

Copyright (C) 1995-2004 Graham Barr.  All rights reserved.

Copyright (C) 2013-2016 Steve Hay.  All rights reserved.

=head1 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 GNU General Public
License or the Artistic License, as specified in the F&lt;LICENCE&gt; file.

=cut
</pre></body></html>