Net::POP3(3perl)
π Net::POP3 β the manual page bestie π
okay so you found Net::POP3(3perl), and honestly? iconic choice. this is the whole page, rewritten for you, every flag and fact intact, no cap. let's get into it π«Ά
β¨ NAME β¨
Net::POP3 β the Post Office Protocol 3 Client class (RFC1939). that's it, that's the vibe.
πΈ SYNOPSIS πΈ
look at this little program. it's giving main character energy:
use Net::POP3;
# Constructors
$pop = Net::POP3->new('pop3host');
$pop = Net::POP3->new('pop3host', Timeout => 60);
$pop = Net::POP3->new('pop3host', 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;
π¦ DESCRIPTION π¦
bestie, this module is a client interface to the POP3 protocol, which means your lil perl5 app gets to have a whole conversation with POP3 servers. this documentation assumes you already know the POP3 protocol described in RFC1939, so if you don't, go read that first, mwah.
with IO::Socket::SSL installed it ALSO gives you support for implicit and explicit TLS encryption β i.e. POP3S or POP3+STARTTLS. secure queen behavior β¨
A new Net::POP3 object must be created with the new method. once you've done that, every single POP3 command is accessed via method calls on the object. periodt.
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. yes, "avaibility" β the original says it like that, we do not fix it, we respect the lore π
π Class Methods π
new([$host][, %options])
This is the constructor for a new Net::POP3 object. $host is the name of the remote host to which an POP3 connection is required.
$host is optional. If $host is not given then it may instead be passed as the "Host" option described below. And if neither is given?? then the "POP3_Hosts" specified in "Net::Config" will be used. no host left behind π
%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 inIO::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. - Port β port to connect to. Default β
110for plain POP3 and995for POP3s (direct SSL). - SSL β If the connection should be done from start with SSL, contrary to later upgrade with
"starttls". You can use SSL arguments as documented in IO::Socket::SSL, but it will usually use the right arguments already. - LocalAddr and LocalPort β 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
ResvPortcan be used instead ofLocalPort. - Domain β This parameter is passed directly to IO::Socket and makes it possible to enforce IPv4 connections even if
IO::Socket::IPis used as super class. AlternativelyFamilycan be used. - Timeout β Maximum time, in seconds, to wait for a response from the POP3 server (default:
120) - Debug β Enable debugging information
π§ Object Methods π§
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.
"Net::POP3" inherits from "Net::Cmd" so methods defined in "Net::Cmd" may be used to send commands to the remote POP3 server in addition to the methods documented here. generational inheritance, we love to see it π
host()
Returns the value used by the constructor, and passed to IO::Socket::INET, to connect to the host.
"auth($username, $password)"
Attempt SASL authentication.
user($user)
Send the USER command.
pass($pass)
Send the PASS command. Returns the number of messages in the mailbox.
"login([$user[, $pass]])"
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.
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. sneaky little string, we stan π
If there was an error authenticating the user then undef will be returned.
starttls(%sslargs)
Upgrade existing plain connection to SSL. You can use SSL arguments as documented in IO::Socket::SSL, but it will usually use the right arguments already. glow-up arc β¨
"apop([$user[, $pass]])"
Authenticate with the server identifying as $user with password $pass. Similar to "login", but the password is not sent in clear text. privacy queen π₯
To use this method you must have the Digest::MD5 or the MD5 module installed, otherwise this method will return undef. no module, no apop, sorry bestie π
banner()
Return the sever's connection banner
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. they're doing their best π
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.
"top($msgnum[, $numlines])"
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.
list([$msgnum])
If called with an argument the "list" returns the size of the message in octets.
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($msgnum[, $fh])"
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.
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. one and done, she's not coming back π
last()
Returns the highest $msgnum of all the messages accessed.
popstat()
Returns a list of two elements. These are the number of undeleted elements and the size of the mbox in octets.
ping($user)
Returns a list of two elements. These are the number of new messages and the total number of messages for $user.
uidl([$msgnum])
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.
delete($msgnum)
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()
Reset the status of the remote POP3 server. This includes resetting the status of all messages to not be deleted. undo button, we love her π
quit()
Quit and close the connection to the remote POP3 server. Any messages marked as deleted will be deleted from the remote mailbox. okay so this is the one that actually does the deleting, remember that π
can_inet6()
Returns whether we can use IPv6.
can_ssl()
Returns whether we can use SSL.
π Notes π
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.
bestie this is the plot twist: noquit=resetruns = your "deleted" messages are still there. the deletion never happened. callquit. i'm begging π«Ά
π EXPORTS π
None. nothing. zero. empty. she said no gifts today π
β KNOWN BUGS β
See https://rt.cpan.org/Dist/Display.html?Status=Active&Queue=libnet.
πΈ SEE ALSO πΈ
Net::Netrc, Net::Cmd, IO::Socket::SSL.
π AUTHOR π
Graham Barr <gbarr@pobox.com <mailto:gbarr@pobox.com>>.
Steve Hay <shay@cpan.org <mailto:shay@cpan.org>> is now maintaining libnet as of version 1.22_02.
π COPYRIGHT π
Copyright (C) 1995-2004 Graham Barr. All rights reserved.
Copyright (C) 2013-2016, 2020 Steve Hay. All rights reserved.
β¨ 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 LICENCE file.
π¦ VERSION π¦
Version 3.15
π DATE π
20 March 2023
π HISTORY π
See the Changes file.
and that's the whole page bestie, you ate that π
β¨ stay slay, call quit, and remember this was shipped as perl v5.44.0, dated 2026-10-17 β that's the footer, folded in all cute at the end like a lil bow ππ«Ά
π¦ where this page comes from
- arch rolling: perl 5.44.0-1 Β· Artistic-1.0-Perl AND GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms