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 - UNDER CONSTRUCTION: new basic message object

SYNOPSIS

  use Mail::Box::Manager;
  my $mgr    = Mail::Box::Manager->new;
  my $folder = $mgr->open(folder => $MAIL);
  my $msg    = $folder->message(2);    # isa Mail::Message

  my Mail::Message $reply      = $msg->reply;
  my Mail::Message $construct  = Mail::Message->new;
  my Mail::Message::Head $head = $msg->head;
  my Mail::Message::Body $body = $msg->body;

  This manual also describes Mail::Message::Part

DESCRIPTION Mail::Message

A Mail::Message object is a container for information read from a file. All intelligence is implemented by sub-classes, most probably by Mail::Box::Message.

METHODS

new OPTIONS

Create a new message object. The message's head and body will be read later, unless specified at construction.

  • body => OBJECT

    Instantiate the message with a body, which has been created somewhere before the message is constructed. The OBJECT must be a (sub-)class of Mail::Message::Body.

  • head => OBJECT

    Instantiate the message with a head, which has been created somewhere before the message is constructed. The OBJECT must be a (sub-)class of Mail::Message::Head.

errors
warnings

Returns a list with all errors/warnings found while processing this message. Examples:

   my @errors = $msg->errors;
   if($msg->errors || $msg->warnings) {...};
parent
isToplevel
toplevel

parent returns the reference to the message where this a part of, and undef if it is not a part, but the main message. The isToplevel returns true, only in the latter case. With toplevel, you get the main message (maybe the current message).

Examples:

    my $msg    = $fh->read;
    my $part   = $msg->part(2);
    my $nested = $part->part(3);

    $nested->parent;     # returns $part
    $nested->toplevel;   # returns $msg
    $msg->parent;        # returns undef
    $msg->toplevel;      # returns $msg
    $msg->isToplevel;    # returns true
body [OBJECT]
head [OBJECT]

Return (optionally after setting) the body/head of this message.

The OBJECT must be an (sub-)class of Mail::Message::Body respectively Mail::Message::Head. However, setting the body is a task of Mail::Box-derivates, and not a usual practice for user programs.

Examples:

    $msg->body->print(\*STDERR);
    $msg->body(Mail::Message::Body::Lines->new);
    my $head = $msg->head(new Mail::Message::Head);

DESCRIPTION Mail::Message::Part

A message may have a multipart body, in which case the main message contains many sub-messages (parts). These parts may be multipart messages by themselves.

The methods available for the parts are the same as for the main messages.

AUTHORS

Mark Overmeer <mark@overmeer.net> David Coppit <david@coppit.org>

VERSION

This code is beta version 1.322, so far from complete. Please contribute with remarks and additions.

COPYRIGHT

Copyright (c) 2001 Mark Overmeer and David Coppit. 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 Mail::Folder::FastReader

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 182:

You forgot a '=back' before '=head1'

Around line 209:

=back without =over