The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Mail::Message::Part - a part of a message, but a message by itself.

CLASS HIERARCHY

 Mail::Message::Part
 is a Mail::Message + ::Construct
 is a Mail::Reporter

SYNOPSIS

 my Mail::Message $message = ...;
 if($message->isMultipart) {
     my Mail::Message::Part $part;

     foreach $part ($message->body->parts) {
         $part->print(\*OUT);
         my $attachbody = $part->head;
         my $attachhead = $part->body;
     }
 }

DESCRIPTION

A Mail::Message::Part object contains a message which is included in an other message. For instance attachments are parts.

READ Mail::Message FIRST. A part is a special message: it has a reference to its parent message, and will usually not be sub-classed into mail-folder-specific variants.

METHOD INDEX

Methods prefixed with an abbreviation are described in Mail::Message (MM), Mail::Reporter (MR), Mail::Message::Construct (MMC).

The general methods for Mail::Message::Part objects:

   MM bcc                               MM messageId
  MMC bounce OPTIONS                    MM modified [BOOL]
  MMC build [MESSAGE|BODY], CONTENT        new OPTIONS
      buildFromBody BODY, MULTIPA...    MM nrLines
   MM cc                                MM parent
   MM date                              MM parts
   MM decoded OPTIONS                   MM print [FILEHANDLE]
   MM destinations                      MM printUndisclosed [FILEHANDLE]
   MM encode OPTIONS                   MMC read FILEHANDLE|SCALAR|REF-...
   MR errors                           MMC reply OPTIONS
  MMC forward OPTIONS                  MMC replyPrelude [STRING|FIELD|...
  MMC forwardPostlude                  MMC replySubject STRING
  MMC forwardPrelude                    MR report [LEVEL]
  MMC forwardSubject STRING             MR reportAll [LEVEL]
   MM from                              MM send [MAILER], OPTIONS
   MM get FIELD                         MM size
   MM guessTimestamp                    MM subject
   MM isDummy                           MM timestamp
   MM isMultipart                       MM to
   MM isPart                            MM toplevel
   MM label LABEL [,VALUE [LABEL,...    MR trace [LEVEL]
   MR log [LEVEL [,STRINGS]]            MR warnings

The extra methods for extension writers:

   MR AUTOLOAD                          MM labelsToStatus
   MM DESTROY                           MR logPriority LEVEL
   MM body [BODY]                       MR logSettings
      clone                             MR notImplemented
      coerce BODY|MESSAGE, MULTIPART    MM readBody PARSER, HEAD [, BO...
   MM head [HEAD]                       MM readFromParser PARSER, [BOD...
   MR inGlobalDestruction               MM readHead PARSER [,CLASS]
   MM isDelayed                         MM statusToLabels
   MM labels                            MM storeBody BODY

METHODS

new OPTIONS

Create a message part. You can add the following options:

 OPTIONS              DESCRIBED IN           DEFAULT
 body                 Mail::Message          <undef>
 head                 Mail::Message          <undef>
 parent               Mail::Message::Part    <obligatory>
  • parent => MESSAGE

    (obligatory) reference to the parental Mail::Message object where this part is a member of. That object may be a part itself.

buildFromBody BODY, MULTIPART, HEADERS

(Class method) Shape a message part around a BODY. Bodies have information about their content in them, which is used to construct a header for the attachment. The MULTIPART refers to the parent body which is a multipart.

Next to that, more HEADERS can be specified as key-value combinations or Mail::Message::Field objects. These are added in order, and before the data from the body is taken. No fields are obligatory.

Example:

 my $part = Mail::Message::Part->buildFromBody($body, $parent);

METHODS for extension writers

coerce BODY|MESSAGE, MULTIPART

In extension to full messages, message parts can be coerced from a BODY Mail::Message::Body. This is because the body data contains enough information. The MULTIPART refers to the parent body.

Parts can be build from Mail::Message::Body, Mail::Message, Mail::Internet, and MIME::Entity objects.

clone

A message part is cloned as plain message, and may be added as such to a folder. It will be coerced into a part when added to a multi-part body.

SEE ALSO

Mail::Box-Overview

For support and additional documentation, see http://perl.overmeer.net/mailbox/

AUTHOR

Mark Overmeer (mailbox@overmeer.net). All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

VERSION

This code is beta, version 2.013.

Copyright (c) 2001-2002 Mark Overmeer. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.