Mail::...:Fetch(3pm)
π NAME π
Mail::Server::IMAP4::Fetch β bestie, this is the message-info glow-up that makes IMAP go zoom β¨
(it lives in the Mail::...:Fetch(3pm) corner of the User Contributed Perl Documentation, and it is serving)
πΈ SYNOPSIS πΈ
my $imap = Mail::Server::IMAP4::Fetch->new($msg);
print $imap->fetchBody(1); # for FETCH BODYSTRUCTURE
print $imap->fetchBody; # for FETCH BODY
print $imap->fetchEnvelope; # for FETCH ENVELOPE
print $imap->fetchSize;
okay so first things first, that's the whole vibe in four lines π«Ά
π¦ DESCRIPTION π¦
So what you're doing here is creating a whole new object hierarchy, and its entire job is holding onto the info that captures the most important details about a message. You use it to speed up IMAP-server implementations, like Mail::Box::Netzwert. Slay.
The object in question is a simplified representation of a Mail::Box::Message object. Important: it does not maintain headers and it does not refer to the folder. It only works with messages stored in a file. Which means β and this is the iconic part β you can freeze this object with Storable if you want to. π
π METHODS π
β¨ Constructors β¨
$class->new( <$message|$part>, %options )
Here's the options tea, in a lil table-vibe:
-Option --Default
md5checksums 0
md5checksums=> BOOLEAN β default is0, no cap
π Attributes π
$obj->bodyLocation()β the body's location, girl. π$obj->headLocation()β and the head's location too$obj->partLocation()β plus the part's location, we love a full set
π IMAP Commands π
$obj->fetchBody($extended)
Returns one string, representing the message's structure exactly how the IMAP protocol defines it. The boolean argument is you telling it whether you want the $extended info β the kind that the imap command 'FETCH BODYSTRUCTURE' defines β or the limited info of 'FETCH BODY'. Choose your fighter β¨
$obj->fetchEnvelope()
Returns a string representation of some header information. cute, brief, useful.
$obj->fetchSize()
Returns the size of the message body. that's it, that's the whole method π
$obj->part( [$partnr] )
The partnummer is a list of dot-separated positive integers, numbering (nested) parts in multi-part message bodies. By default, the info of the main message is returned. π§
Β» example:
my $partinfo = $msg->info->part('1.2.1');
print $msg->info->part('3.3')->fetchBody;
$obj->printStructure( [<$fh|undef>, [$number]] )
Prints the structure of the fetch data to the specified $fh, or to the selected filehandle. And when you explicitly pass "undef" as the handle, then the output gets returned as a string instead. Heads up though: only a limited set of the information is displayed. π
Β» example:
my $imap = ...;
$imap->printStructure(\*OUTPUT);
$imap->printStructure;
my $struct = $imap->printStructure(undef);
π Internals π
(this section is giving absolutely nothing, and that's on purpose, bestie β there's nothing listed under it)
β DETAILS β
See:
RFC2060:"Internet Message Access Protocol IMAP4v1"section7.4.2RFC2045:"MIME Part One: Format of Internet Message Bodies".
π₯ SEE ALSO π₯
This module is part of Mail-Box-IMAP4 version 4.01, built on December 13, 2025. Website: http://perl.overmeer.net/CPAN/
π LICENSE π
For contributors see file ChangeLog.
This software is copyright (c) 2001-2025 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.
and that's the whole page, bestie π«Ά this was perl v5.40.1, dated 2026-01-21, and it's Mail::...:Fetch(3pm) β go forth and let your IMAP servers be fast, mwah π
π¦ where this page comes from
- ubuntu resolute: libmail-box-imap4-perl 4.01-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libmail-box-imap4-perl 4.01-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