| Server IP : 88.99.149.37 / Your IP : 216.73.216.141 Web Server : nginx/1.31.2 System : Linux server-88-99-149-37 6.12.0-124.56.5.el10_1.x86_64 #1 SMP PREEMPT_DYNAMIC Fri May 15 06:12:08 EDT 2026 x86_64 User : muralimurth ( 1015) PHP Version : 8.4.23 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/local/share/man/man3/ |
Upload File : |
.\" -*- mode: troff; coding: utf-8 -*-
.\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.45)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
.ie n \{\
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is >0, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{\
. if \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{\
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "Mail::IMAPClient::BodyStructure 3"
.TH Mail::IMAPClient::BodyStructure 3 2020-10-12 "perl v5.40.2" "User Contributed Perl Documentation"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH NAME
Mail::IMAPClient::BodyStructure \- parse fetched results
.SH SYNOPSIS
.IX Header "SYNOPSIS"
.Vb 2
\& use Mail::IMAPClient;
\& use Mail::IMAPClient::BodyStructure;
\&
\& my $imap = Mail::IMAPClient\->new(
\& Server => $server, User => $login, Password => $pass
\& );
\&
\& $imap\->select("INBOX") or die "Could not select INBOX: $@\en";
\&
\& my @recent = $imap\->search("recent") or die "No recent msgs in INBOX\en";
\&
\& foreach my $id (@recent) {
\& my $bsdat = $imap\->fetch( $id, "bodystructure" );
\& my $bso = Mail::IMAPClient::BodyStructure\->new( join("", $imap\->History) );
\& my $mime = $bso\->bodytype . "/" . $bso\->bodysubtype;
\& my $parts = map( "\en\et" . $_, $bso\->parts );
\& print "Msg $id (Content\-type: $mime) contains these parts:$parts\en";
\& }
.Ve
.SH DESCRIPTION
.IX Header "DESCRIPTION"
This extension will parse the result of an IMAP FETCH BODYSTRUCTURE
command into a perl data structure. It also provides helper methods
to help pull information out of the data structure.
.PP
This module requires Parse::RecDescent.
.SH "Class Methods"
.IX Header "Class Methods"
The following class method is available:
.SS new
.IX Subsection "new"
This class method is the constructor method for instantiating new
Mail::IMAPClient::BodyStructure objects. The \fBnew\fR method accepts
one argument, a string containing a server response to a FETCH
BODYSTRUCTURE directive.
.PP
The module \fBMail::IMAPClient\fR provides the \fBget_bodystructure\fR
convenience method to simplify use of this module when starting with
just a messages sequence number or unique ID (UID).
.SH "Object Methods"
.IX Header "Object Methods"
The following object methods are available:
.SS bodytype
.IX Subsection "bodytype"
The \fBbodytype\fR object method requires no arguments. It returns the
bodytype for the message whose structure is described by the calling
\&\fBMail::IMAPClient::Bodystructure\fR object.
.SS bodysubtype
.IX Subsection "bodysubtype"
The \fBbodysubtype\fR object method requires no arguments. It returns the
bodysubtype for the message whose structure is described by the calling
\&\fBMail::IMAPClient::Bodystructure\fR object.
.SS bodyparms
.IX Subsection "bodyparms"
The \fBbodyparms\fR object method requires no arguments. It returns the
bodyparms for the message whose structure is described by the calling
\&\fBMail::IMAPClient::Bodystructure\fR object.
.SS bodydisp
.IX Subsection "bodydisp"
The \fBbodydisp\fR object method requires no arguments. It returns the
bodydisp for the message whose structure is described by the calling
\&\fBMail::IMAPClient::Bodystructure\fR object.
.SS bodyid
.IX Subsection "bodyid"
The \fBbodyid\fR object method requires no arguments. It returns the
bodyid for the message whose structure is described by the calling
\&\fBMail::IMAPClient::Bodystructure\fR object.
.SS bodydesc
.IX Subsection "bodydesc"
The \fBbodydesc\fR object method requires no arguments. It returns the
bodydesc for the message whose structure is described by the calling
\&\fBMail::IMAPClient::Bodystructure\fR object.
.SS bodyenc
.IX Subsection "bodyenc"
The \fBbodyenc\fR object method requires no arguments. It returns the
bodyenc for the message whose structure is described by the calling
\&\fBMail::IMAPClient::Bodystructure\fR object.
.SS bodysize
.IX Subsection "bodysize"
The \fBbodysize\fR object method requires no arguments. It returns the
bodysize for the message whose structure is described by the calling
\&\fBMail::IMAPClient::Bodystructure\fR object.
.SS bodylang
.IX Subsection "bodylang"
The \fBbodylang\fR object method requires no arguments. It returns the
bodylang for the message whose structure is described by the calling
\&\fBMail::IMAPClient::Bodystructure\fR object.
.SS bodystructure
.IX Subsection "bodystructure"
The \fBbodystructure\fR object method requires no arguments. It returns
the bodystructure for the message whose structure is described by the
calling \fBMail::IMAPClient::Bodystructure\fR object.
.SS envelopestruct
.IX Subsection "envelopestruct"
The \fBenvelopestruct\fR object method requires no arguments. It returns
a \fBMail::IMAPClient::BodyStructure::Envelope\fR object for the message
from the calling \fBMail::IMAPClient::Bodystructure\fR object.
.SS textlines
.IX Subsection "textlines"
The \fBtextlines\fR object method requires no arguments. It returns the
textlines for the message whose structure is described by the calling
\&\fBMail::IMAPClient::Bodystructure\fR object.
.SH Mail::IMAPClient::BodyStructure::Envelope
.IX Header "Mail::IMAPClient::BodyStructure::Envelope"
The IMAP standard specifies that output from the IMAP \fBFETCH
ENVELOPE\fR command will be an RFC2060 envelope structure. It further
specifies that output from the \fBFETCH BODYSTRUCTURE\fR command may also
contain embedded envelope structures (if, for example, a message's
subparts contain one or more included messages). Objects belonging to
\&\fBMail::IMAPClient::BodyStructure::Envelope\fR are Perl representations
of these envelope structures, which is to say the nested parenthetical
lists of RFC2060 translated into a Perl datastructure.
.PP
Note that all of the fields relate to the specific part to which they
belong. In other words, output from a FETCH nnnn ENVELOPE command
(or, in \fBMail::IMAPClient\fR, \f(CW\*(C`$imap\-\*(C'\fRfetch($msgid,"ENVELOPE")> or
\&\f(CW\*(C`my $env = $imap\-\*(C'\fRget_envelope($msgid)>) are for the message, but
fields from within a bodystructure relate to the message subpart and
not the parent message.
.PP
An envelope structure's \fBMail::IMAPClient::BodyStructure::Envelope\fR
representation is a hash of thingies that looks like this:
.PP
.Vb 12
\& {
\& subject => "subject",
\& inreplyto => "reference_message_id",
\& from => [ addressStruct1 ],
\& messageid => "message_id",
\& bcc => [ addressStruct1, addressStruct2 ],
\& date => "Tue, 09 Jul 2002 14:15:53 \-0400",
\& replyto => [ adressStruct1, addressStruct2 ],
\& to => [ adressStruct1, addressStruct2 ],
\& sender => [ adressStruct1 ],
\& cc => [ adressStruct1, addressStruct2 ],
\& }
.Ve
.PP
The \fB...::Envelope\fR object also has methods for accessing data in the
structure. They are:
.IP date 4
.IX Item "date"
Returns the date of the message.
.IP inreplyto 4
.IX Item "inreplyto"
Returns the message id of the message to which this message is a reply.
.IP subject 4
.IX Item "subject"
Returns the subject of the message.
.IP messageid 4
.IX Item "messageid"
Returns the message id of the message.
.PP
You can also use the following methods to get addressing information.
Each of these methods returns an array of
\&\fBMail::IMAPClient::BodyStructure::Address\fR objects, which are perl
data structures representing RFC2060 address structures. Some of
these arrays would naturally contain one element (such as \fBfrom\fR,
which normally contains a single "From:" address); others will often
contain more than one address. However, because RFC2060 defines all
of these as "lists of address structures", they are all translated
into arrays of \fB...::Address\fR objects.
.PP
See the section on \fBMail::IMAPClient::BodyStructure::Address\fR, below,
for alternate (and preferred) ways of accessing these data.
.PP
The methods available are:
.IP bcc 4
.IX Item "bcc"
Returns an array of blind cc'ed recipients' address structures.
(Don't expect much in here unless the message was sent from the
mailbox you're poking around in, by the way.)
.IP cc 4
.IX Item "cc"
Returns an array of cc'ed recipients' address structures.
.IP from 4
.IX Item "from"
Returns an array of "From:" address structures\-\-usually just one.
.IP replyto 4
.IX Item "replyto"
Returns an array of "Reply-to:" address structures. Once again there
is usually just one address in the list.
.IP sender 4
.IX Item "sender"
Returns an array of senders' address structures\-\-usually just one and
usually the same as \fBfrom\fR.
.IP to 4
.IX Item "to"
Returns an array of recipients' address structures.
.PP
Each of the methods that returns a list of address structures (i.e. a
list of \fBMail::IMAPClient::BodyStructure::Address\fR arrays) also has
an analogous method that will return a list of E\-Mail addresses
instead. The addresses are in the format \f(CW\*(C`personalname
<mailboxname@hostname>\*(C'\fR (see the section on
\&\fBMail::IMAPClient::BodyStructure::Address\fR, below) However, if the
personal name is 'NIL' then it is omitted from the address.
.PP
These methods are:
.IP bcc_addresses 4
.IX Item "bcc_addresses"
Returns a list (or an array reference if called in scalar context) of
blind cc'ed recipients' email addresses. (Don't expect much in here
unless the message was sent from the mailbox you're poking around in,
by the way.)
.IP cc_addresses 4
.IX Item "cc_addresses"
Returns a list of cc'ed recipients' email addresses. If called in a
scalar context it returns a reference to an array of email addresses.
.IP from_addresses 4
.IX Item "from_addresses"
Returns a list of "From:" email addresses. If called in a scalar
context it returns the first email address in the list. (It's usually
a list of just one anyway.)
.IP replyto_addresses 4
.IX Item "replyto_addresses"
Returns a list of "Reply-to:" email addresses. If called in a scalar
context it returns the first email address in the list.
.IP sender_addresses 4
.IX Item "sender_addresses"
Returns a list of senders' email addresses. If called in a scalar
context it returns the first email address in the list.
.IP to_addresses 4
.IX Item "to_addresses"
Returns a list of recipients' email addresses. If called in a scalar
context it returns a reference to an array of email addresses.
.PP
Note that context affects the behavior of all of the above methods.
.PP
Those fields that will commonly contain multiple entries (i.e. they
are recipients) will return an array reference when called in scalar
context. You can use this behavior to optimize performance.
.PP
Those fields that will commonly contain just one address (the
sender's) will return the first (and usually only) address. You can
use this behavior to optimize your development time.
.SH "Addresses and the Mail::IMAPClient::BodyStructure::Address"
.IX Header "Addresses and the Mail::IMAPClient::BodyStructure::Address"
Several components of an envelope structure are address structures.
They are each parsed into their own object,
\&\fBMail::IMAPClient::BodyStructure::Address\fR, which looks like this:
.PP
.Vb 6
\& {
\& mailboxname => \*(Aqsomebody.special\*(Aq,
\& hostname => \*(Aqsomplace.weird.com\*(Aq
\& personalname => \*(AqSomebody Special
\& sourceroute => \*(AqNIL\*(Aq
\& }
.Ve
.PP
RFC2060 specifies that each address component of a bodystructure is a
list of address structures, so \fBMail::IMAPClient::BodyStructure\fR
parses each of these into an array of
\&\fBMail::IMAPClient::BodyStructure::Address\fR objects.
.PP
Each of these objects has the following methods available to it:
.IP mailboxname 4
.IX Item "mailboxname"
Returns the "mailboxname" portion of the address, which is the part to
the left of the '@' sign.
.IP hostname 4
.IX Item "hostname"
Returns the "hostname" portion of the address, which is the part to
the right of the '@' sign.
.IP personalname 4
.IX Item "personalname"
Returns the "personalname" portion of the address, which is the part
of the address that's treated like a comment.
.IP sourceroute 4
.IX Item "sourceroute"
Returns the "sourceroute" portion of the address, which is typically "NIL".
.PP
Taken together, the parts of an address structure form an address that
will look something like this:
.PP
\&\f(CW\*(C`personalname <mailboxname@hostname>\*(C'\fR
.PP
Note that because the \fBMail::IMAPClient::BodyStructure::Address\fR
objects come in arrays, it's generally easier to use the methods
available to \fBMail::IMAPClient::BodyStructure::Envelope\fR to obtain
all of the addresses in a particular array in one operation. These
methods are provided, however, in case you'd rather do things the hard
way. (And also because the aforementioned methods from
\&\fBMail::IMAPClient::BodyStructure::Envelope\fR need them anyway.)
.SH AUTHOR
.IX Header "AUTHOR"
Original author: David J. Kernen; Reworked by: Mark Overmeer;
Maintained by Phil Pearl.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fBperl\fR\|(1), Mail::IMAPClient, Parse::RecDescent, and RFC2060.