Raku Land

Net::POP3

github:retupmoca

P6-Net-POP3

A pure-perl implementation of a POP3 client.

Example Usage

####
# raw interface
####
my $pop = Net::POP3.new(:server("your.server.here"), :port(110), :debug, :raw);
$pop.get-response # +OK

$pop.apop-login("username", "password");
# or (less secure)
$pop.user("username");
$pop.pass("password");

my $message-list = $pop.list; # +OK 2 messages\r\n1 120\r\n...
say $pop.retr(1); # +OK \r\nFrom:...
$pop.dele(1);
$pop.quit;

####
# simple interface
####
my $pop = Net::POP3.new(:server("your.server.here"), :port(110), :debug);
$pop.auth("username", "password"); # tries apop, then falls back to user/pass
my $count = $pop.message-count;
my @messages = $pop.get-messages;
for @messages {
    my $unique-id = .uid;
    my $raw-data = .data;
    my $email-mime = .mime; # returns Email::MIME object
                            # (requires Email::MIME installed to work)
    .delete;
}
$pop.quit;

Simple mode methods

Note that all of these methods should return a true value (or a valid false response, such as '0' from message-count) on success or a Failure object on failure.

Net::POP3::Message Methods

This class contains the actual message from the POP3 server.