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::Body - UNDER CONSTRUCTION: Contains the data of a body in a Mail::Message

SYNOPSIS

   my Mail::Message $msg = ...;
   my $body  = $msg->body;
   my @lines = $body->lines;
   my $text  = $body->string;
   my FileHandle $file = $body->file;
   $body->write(\*FILE);

DESCRIPTION

The body of a message (a Mail::Message object) is stored in one of the body-variations. The fuctionality of each body-type is equivalent, but there are performance implications.

  • Mail::Message::Body::Lines

    Each line of the message-body is stored as single scalar. This is a useful set-up for a detailed look in the message-body, which is usually line-organized.

  • Mail::Message::Body::Scalar

    The whole message-body is stored in one scalar. Small message can be contained this way without penalty.

  • Mail::Message::Body::File

    The message body is stored in an external temporary file. This type of storage is especially useful when the body is large, the total folder is large, or memory is small.

  • Mail::Message::Body::NotParsed

    The message-body is not yet read-in, but the exact location of the body is known so the message can be read when needed.

  • Mail::Message::Body::Multipart

    The message-body contains a set of sub-messages (which can contain multiparted bodies themselves). Each sub-message is an instance of Mail::Message::Part, which is an extention of Mail::Message.

Each body-type has methods to produce the storage of the other types. As example, you can ask any body-type for the message as list of lines, but for the ::Body::Lines type this call will be most efficient.

GENERAL METHODS

new OPTIONS

Each body-type has a few extra options, but all bodies share the following:

  • data => FILE | REF-ARRAY-OF-LINES | SCALAR

    The content of the body can be specified in various ways. See the data method below on how they work.

data FILE | LIST-OF-LINES | REF-ARRAY-OF-LINES | SCALAR

Store the specified data as body, replacing the old content.

Dependent on the type of body and the type of data supplied, this may be little work or a lot of work.

Examples:

   my $body = Mail::Message::Body::Lines->new;
   $body->data(\*INBOX);
   $body->data("first line", $second_line);
   $body->data( ["first line", $second_line] );
   $body->data("first line\n$second_line\n");
scalar

Return the content of the body as a scalar.

lines

Return the content of the body as a list of lines.

file

Return the content of the body as a file-pointer. The returned stream may be a real file, or a simulated file in any form that perl knows. At least, you can read from it.

AUTHORS

Mark Overmeer <mark@overmeer.net>

VERSION

This code is alpha version 1.313, and far from complete. Please contribute with remarks and additions.

COPYRIGHT

Copyright (c) 2001 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.

SEE ALSO

Mail::Box::Manager

1 POD Error

The following errors were encountered while parsing the POD:

Around line 72:

'=item' outside of any '=over'