Alexandra Hrefna Maheu


Mail::MBX::Message - An MBX mailbox message object


    use Mail::MBX ();

    my $mbx = Mail::MBX->open('mailbox.mbx');

    # Fetch and read first message in mailbox
    my $message = $mbx->message;

    # Write message body to standard output
    while (my $readlen = $message->read(my $buf, 4096)) {
        print $buf;



Mail::MBX::Message represents an MBX message object within an existing Mail::MBX file object. Because Mail::MBX::Message objects contain state specific to the parent object's file handle, only one message can be read per mailbox at a time.



Not intended to be used as part of a public interface. Given the file handle specified in $fh, this method will return a new Mail::MBX::Message object representing the message found at the current position of $fh.


Reset internal file handle position to beginning of message.

$message->read($buf, $len)

Read at most $len bytes from the current message, into a scalar variable in the argument of $buf, and return the number of bytes actually read from the current message.


Written by Xan Tronix <>


Copyright (c) 2014, cPanel, Inc. Distributed under the terms of the MIT license.