Mail::Box::POP3(3pm)
π NAME π
Mail::Box::POP3 β handle POP3 folders as client. That's the whole job description, bestie, and it ate. π
π INHERITANCE π
okay so the family tree goes like this:
Mail::Box::POP3- is a
Mail::Box::Net - is a
Mail::Box - is a
Mail::Reporter
- is a
Mail::Box::POP3is extended byMail::Box::POP3sβ¨
π SYNOPSIS π
use Mail::Box::POP3;
my $folder = Mail::Box::POP3->new(folder => $ENV{MAIL}, ...);
πΈ DESCRIPTION πΈ
So picture this: you've got a folder, right, but its messages are living on a remote server. Not your house. Somebody else's house. π The client app and the server chit-chat using the POP3 protocol. This class is the one that keeps all of that gossip flowing, but it outsources the actual talking to Mail::Transport::POP3 so it doesn't have to hide the transport of information itself β its only obsession is handling messages correctly inside a POP3 folder. Focused. Main character energy. π
β οΈ real talk, bestie: this module at versions 4.0 and up is not fully compatible with older releases. The big glow-up was mainly in the exception handling. When you need to upgrade, please read https://github.com/markov2/perl5-Mail-Box/wiki/ β and good news, Version 3 is still maintained and may see new releases as well. π«Ά
Extends DESCRIPTION in Mail::Box::Net.
π₯ OVERLOADED π₯
Extends OVERLOADED in Mail::Box::Net.
- overload:
'""'stringification β inherited, seeOVERLOADEDinMail::Box - overload:
'@{}'use as ARRAY β inherited, seeOVERLOADEDinMail::Box - overload:
cmpstring comparison β inherited, seeOVERLOADEDinMail::Box
π METHODS π
Extends METHODS in Mail::Box::Net.
π§ Constructors
Extends Constructors in Mail::Box::Net.
$class->new(%options)
So for authentications you have three choices, and honestly pick your fighter: specify a foldername which resembles an URL, or specify a pop-client object, or give separate options for user, password, pop-server and server-port. It improves on the base version β see Constructors in Mail::Box.
Here's the whole options lineup, with where each one comes from and what it defaults to, because we do NOT gatekeep defaults in this house:
access=>$modeβ fromMail::Box, defaults to'r'.authenticate=>'LOGIN'|'APOP'|'AUTO'|'OUATH2'|'OAUTH2_SEP'β defaults to'AUTO'. POP3 can use two methods of authentication: the old LOGIN protocol, which transmits a username and password in plain text π¬, and the newer APOP protocol which uses MD5 encryption. APOP is therefore much better, however not always supported by the server. With AUTO, first APOP is tried and if that fails LOGIN.OAUTH*requires the authorization token to be passed as Password. Microsoft Office365 needs"OAUTH2_SEP", where other oauth2 implementations use"OAUTH2".body_delayed_type=>CLASSβ fromMail::Box, defaults toMail::Message::Body::Delayed.body_type=>CLASS|CODEβ fromMail::Box, defaults toMail::Message::Body::Lines.coerce_options=>ARRAYβ fromMail::Box, defaults to+[].create=>BOOLEANβ fromMail::Box, defaults to<not applicable>.extract=>INTEGER|CODE|METHOD|'LAZY'|'ALWAYS'β fromMail::Box, defaults to10240.field_type=>$classβ fromMail::Box, defaults toundef.fix_headers=>BOOLEANβ fromMail::Box, defaults tofalse.folder=>$nameβ fromMail::Box, defaults to<not applicable>.folderdir=>$directoryβ fromMail::Box, defaults to<network location>.head_delayed_type=>$classβ fromMail::Box, defaults toMail::Message::Head::Delayed.head_type=>$classβ fromMail::Box, defaults toMail::Message::Head::Complete.keep_dups=>BOOLEANβ fromMail::Box, defaults tofalse.lock_file=>$fileβ fromMail::Box, defaults toundef.lock_timeout=>$secondsβ fromMail::Box, defaults to1 hour.lock_type=>$class|$name|\@namesβ fromMail::Box, defaults to'NONE'.lock_wait=>$secondsβ fromMail::Box, defaults to10 seconds.locker=>$lockerβ fromMail::Box, defaults toundef.manager=>$managerβ fromMail::Box, defaults toundef.message_type=>$classβ fromMail::Box, defaults toMail::Box::POP3::Message.multipart_type=>CLASSβ fromMail::Box, defaults toMail::Message::Body::Multipart.password=>$passwordβ fromMail::Box::Net, defaults toundef.pop_client=>OBJECTβ defaults toundef. You may want to specify your own pop-client object. The object which is passed must extendMail::Transport::POP3.remove_when_empty=>BOOLEANβ fromMail::Box, defaults to<false>.save_on_exit=>BOOLEANβ fromMail::Box, defaults totrue.server_name=>$hostβ fromMail::Box::Net, defaults toundef.server_port=>$numberβ fromMail::Box::Net, defaults to110.ssl_options=>HASHβ defaults toundef.trusted=>BOOLEANβ fromMail::Box, defaults to<false>.use_ssl=>BOOLEANβ defaults tofalse.username=>$usernameβ fromMail::Box::Net, defaults toundef.
Β» example, because examples are the whole vibe:
my $url = 'pop3://user:password@pop.xs4all.nl'
my $pop = Mail::Box::POP3->new($url);
my $pop = $mgr->open(type => 'pop3',
username => 'myname', password => 'mypassword',
server_name => 'pop.xs4all.nl'
);
π¦ Attributes
Extends Attributes in Mail::Box::Net.
$obj->fixHeaders()β inherited, seeAttributesinMail::Box$obj->folderdir( [$directory] )β inherited, seeAttributesinMail::Box$obj->isTrusted()β inherited, seeAttributesinMail::Box$obj->name()β inherited, seeAttributesinMail::Box$obj->removeEmpty()β inherited, seeAttributesinMail::Box$obj->type()β inherited, seeAttributesinMail::Box
π The folder
Extends The folder in Mail::Box::Net.
$obj->addMessage($message)β ngl, it is impossible to write messages to the average POP3 server π. There are extensions to the protocol which do permit it, however these are not implemented (yet, patches welcome π₯Ί).undefis returned, and an error displayed. However, no complaint is given when the$messageisundefitself. Improves base, seeThe folderinMail::Box.share=>BOOLEANβ fromMail::Box, defaults to<not used>.
$obj->addMessages($messages)β as useless asaddMessage(), fr fr. The only acceptable call to this method is without any message. Improves base, seeThe folderinMail::Box.$class->appendMessages(%options)β inherited, seeThe folderinMail::Box$obj->close(%options)β inherited, seeThe folderinMail::Box$obj->copyTo($folder, %options)β inherited, seeThe folderinMail::Box$obj->delete(%options)β you cannot delete a POP3 folder remotely π: the best we can do is remove all the messages in it... which is literally the action implemented here. A notice is logged about this. Improves base, seeThe folderinMail::Box.recursive=>BOOLEANβ fromMail::Box, defaults to<not used>.
$obj->organization()β inherited, seeThe folderinMail::Box$obj->size()β inherited, seeThe folderinMail::Box$obj->update()β NOT IMPLEMENTED YET. Improves base, seeThe folderinMail::Box.$obj->url()β inherited, seeThe folderinMail::Box
π© Folder flags
Extends Folder flags in Mail::Box::Net.
$obj->access()β inherited, seeFolder flagsinMail::Box$obj->isModified()β inherited, seeFolder flagsinMail::Box$obj->modified( [BOOLEAN] )β inherited, seeFolder flagsinMail::Box$obj->writable()β inherited, seeFolder flagsinMail::Box
βοΈ The messages
Extends The messages in Mail::Box::Net.
$obj->current( [$number|$message|$message_id] )β inherited, seeThe messagesinMail::Box$obj->find($message_id)β inherited, seeThe messagesinMail::Box$obj->findFirstLabeled( $label, [BOOLEAN, [\@msgs]] )β inherited, seeThe messagesinMail::Box$obj->message( $index, [$message] )β inherited, seeThe messagesinMail::Box$obj->messageId( $message_id, [$message] )β inherited, seeThe messagesinMail::Box$obj->messageIds()β inherited, seeThe messagesinMail::Box$obj->messages( <'ALL'|$range|'ACTIVE'|'DELETED'|$label|!$label|$filter> )β inherited, seeThe messagesinMail::Box$obj->nrMessages(%options)β inherited, seeThe messagesinMail::Box$obj->scanForMessages($message, $message_ids, $timespan, $window)β inherited, seeThe messagesinMail::Box
ποΈ Sub-folders
Extends Sub-folders in Mail::Box::Net.
$any->listSubFolders(%options)β the standard POP3 protocol does not support sub-folders, so an empty list will be returned in any case. πΆ Improves base, seeSub-foldersinMail::Box.check=>BOOLEANβ fromMail::Box, defaults tofalse.folder=>$nameβ fromMail::Box, defaults to<from calling object>.folderdir=>$dirβ fromMail::Box, defaults to<from folder>.skip_empty=>BOOLβ fromMail::Box, defaults tofalse.
$any->nameOfSubFolder( $subname, [$parentname] )β inherited, seeSub-foldersinMail::Box$obj->openRelatedFolder(%options)β inherited, seeSub-foldersinMail::Box$obj->openSubFolder(%options)β it is not possible to open a sub-folder for a POP3 folder, because that is not supported by the official POP3 protocol π βοΈ. In any case,undefis returned to indicate a failure. Improves base, seeSub-foldersinMail::Box.$any->topFolderWithMessages()β inherited, seeSub-foldersinMail::Box
π§ Internals
Extends Internals in Mail::Box::Net.
$obj->coerce($message, %options)β inherited, seeInternalsinMail::Box$any->create($folder, %options)β it is not possible to create a new folder on a POP3 server π«. This method will always returnfalse. Improves base, seeMETHODSinMail::Box::Net.folderdir=>$directoryβ fromMail::Box, defaults toundef.
$obj->determineBodyType($message, $head)β inherited, seeInternalsinMail::Box$class->foundIn( [$foldername], %options )β inherited, seeInternalsinMail::Box$obj->getHead($message)β read the header for the specified message from the remote server. π
okay don't dip yet bestie, this page has more coming β part 2 is on the way πβ¨
$obj->read(%options)β inherited, babes. Run to "Internals" inMail::Boxfor the tea. β$obj->readMessages(%options)β also inherited, same spot inMail::Box.$obj->storeMessage($message)β inherited,Mail::Box, you know the drill. π$obj->toBeThreaded($messages)β inherited, see "Internals" inMail::Box.$obj->toBeUnthreaded($messages)β inherited, "Internals" inMail::Box. Yes, it's the un-version. π$obj->updateMessages(%options)β inherited, "Internals" inMail::Box.$obj->write(%options)β inherited, "Internals" inMail::Box.$obj->writeMessages(%options)β inherited, "Internals" inMail::Box, and it takes exactly one option:messagesβ default is<required>(so likeβ¦ you must pass it, bestie), defined over inMail::Box, and it wants anARRAY.
πΈ Other methods πΈ
Extends "Other methods" in Mail::Box::Net β go look there for the rest, this is just the encore. π
$any->timespan2seconds($time)β inherited, see "Other methods" inMail::Box. Note it's called on$any, not$obj, because sometimes the universe is like that. β¨
π¨ Error handling π¨
Extends "Error handling" in Mail::Box::Net.
$obj->AUTOLOAD()β inherited, see "Error handling" inMail::Reporter.$obj->notImplemented()β inherited, see "Error handling" inMail::Reporter.
π§Ή Cleanup π§Ή
Extends "Cleanup" in Mail::Box::Net.
$obj->DESTROY()β inherited, see "Cleanup" inMail::Box.
π DETAILS π
Extends "DETAILS" in Mail::Box::Net.
π Different kinds of folders π
Extends "Different kinds of folders" in Mail::Box::Net.
π Available folder types π
Extends "Available folder types" in Mail::Box::Net.
π Folder class implementation π
Extends "Folder class implementation" in Mail::Box::Net.
π¦ How POP3 folders work π¦
Rfc1939 defines how POP3 works β that's the vibe check of record, no cap. POP3 is a really simple protocol for getting messages from a server to a user's client. It's also really limited: it can only be used to fetch messages, and it does not have many ways to limit the amount of network traffic, the way that IMAP4 does. π
One POP3 account = exactly one folder. There is genuinely no way to have sub-folders in POP3. Periodt. And POP3 doesn't support writing β except for some message status flags. That's it, that's the whole menu. π
β This implementation β
The protocol specifics live in Mail::Transport::POP3, written by Liz Mattijsen β iconic behavior, we stan. π«Ά
That module does not use any of the other POP3 modules available on CPAN, for one reason: MailBox is trying to be smarter. It is capable of re-establishing a broken POP3 connection when the server supports UIDs. Main character energy only. π
The implementation has shown to work with many different POP servers. And in the test directory of the distribution, you'll find a small server implementation, which is used to test the client. Cute, functional, slay. β¨
π DIAGNOSTICS π
Okay bestie, this is the part where things go wrong. Read it, fr fr.
Error: Cannot find head back for $id on POP3 server $name.The server told us this message exists, but when we asked for its headers, not a single line came back. Did the message get destroyed?? π Cast bygetHeadAndBody().Error: Cannot read body for $id on POP3 server $name.The headers came through from the server fine, but the body seems to be lost. Did the message get destroyed between reading the header and reading the body? Chaos. Cast bygetHeadAndBody().Error: Folder $name is opened read-onlyYou cannot write to this folder unless you opened it to write or append withnew(access), or the"force"option is set to"true". Cast bywrite().Warning: Message $id on POP3 server $name disappeared.The server previously indicated this message existed, but now it has no information about it anymore. It's giving ghosting. π Cast bygetHeadAndBody().Warning: POP3 folders cannot be deleted.Every user has only one POP3 folder on a server, and that folder is created and deleted by the server's administrator only. Not your call, sorry babe. Cast bydelete().Error: cannot create POP3 client for $name.The connection to the POP3 server cannot be established. You may see more, related, error messages about the failure. Cast bypopClient().Warning: changes not written to read-only folder $name.You opened the folder read-only β which is the default set bynew(access)β you made modifications, and now you want to close it. Setclose(force)if you want to overrule the access mode, or close the folder withclose(write)set to"NEVER". Cast byclose().Error: class $package does not implement method $method.Fatal error: the specific$package(or one of its superclasses) does not implement this method where it should. This means some other related classes do implement this method, but the class at hand does not. Probably you should investigate this and probably inform the author of the package. Cast bynotImplemented().Error: copying failed for one message.For some reason β disk full, removed by an external process, or read-protection β it is impossible to copy one of the messages. Copying will proceed for the other messages though, so not all is lost. Cast bycopyTo().Error: destination folder $name is not writable.The folder where the messages are copied to is not opened with write access (seenew(access)). This has no relation with write permission to the folder, which is controlled by your operating system. Cast bycopyTo().Warning: different messages with id $msgid.The message id was discovered more than once within the same folder, but the content of the message seems to be different. This should not be possible: each message must be unique. Sus. Cast bymessageId().Error: invalid timespan '$span'.The string does not follow the strict rules of the time span syntax which is permitted as parameter. Cast bytimespan2seconds().Warning: message $id disappeared from POP3 server $name.Cast bygetHead(). π¨Warning: message-id '$msgid' does not contain a domain.According to the RFCs, message-ids need to contain a unique random part, then an"@", and then a domain name. This is made to avoid the creation of two messages with the same id. The warning emerges when the"@"is missing from the string. Cast bymessageId().Error: unknown value to folder->close(write => $when).Cast byclose().Warning: update of $count messages ignored for POP3 folder $name.The standard POP3 implementation does not support writing from client back to the server. Therefore, modifications may be lost. π Cast bywriteMessages().Error: you cannot write a message to a pop server (yet)Some extensions to the POP3 protocol do permit writing messages to the server, but the standard protocol only implements retreival. Feel invited to extend our implementation with writing. π Cast byaddMessage().Error: you cannot write messages to a pop server (yet)Cast byaddMessages().
π SEE ALSO π
This module is part of Mail-Box-POP3 version 4.02, built on April 10, 2026. Website: http://perl.overmeer.net/CPAN/ β¨
π LICENSE π
For contributors see file ChangeLog.
This software is copyright (c) 2001-2026 by Mark Overmeer. π«Ά
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
okay that's the whole page bestie, you're welcome π this was perl v5.40.1, dated 2026-05-09, and the page is Mail::Box::POP3(3pm) β go forth and fetch your mail, no cap πΈπ¦
π¦ where this page comes from
- ubuntu stonking: libmail-box-pop3-perl 4.02-1 Β· Artistic-1.0-Perl OR 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