NAME

Mail::Dir::Message - A message in a Maildir queue

SYNOPSIS

#
# Mark message as Draft
#
$message->mark('D');

#
# Verify that message was marked as Draft
#
print "Message is a draft\n" if $message->draft;

DESCRIPTION

Mail::Dir::Message objects represent messages delivered to a Maildir mailbox, and are created queries to the mailbox as issued by the method Mail::Dir->messages(). Mail::Dir::Message objects are not presently meant to be instantiated directly.

READING MESSAGES

$message->open()

Open the current message, returning a file handle. Will die() if any errors are encountered. It is the caller's responsibility to subsequently close the file handle when it is no longer required.

MOVING MESSAGES

$message->move($mailbox)

Move the current message to a different Maildir++ mailbox. This operation is only supported when the originating mailbox is created with Maildir++ extensions.

REMOVING MESSAGES

$message->remove()

Unlink the current message. This method has the same return value as "unlink" in perlfunc. Note: if removal succeeds, the object is no longer valid and should be disposed of.

Do not use this to soft-delete messages. For that, set the T flag instead.

SETTING MESSAGE FLAGS

$message->mark($flags, $queue)

Set any of the following message status flags on the current message. More than one flag may be specified in a single call, in any order.

  • P

    Mark the message as "Passed".

  • R

    Mark the message as "Replied".

  • S

    Mark the message as "Seen".

  • T

    Mark the message as "Trashed".

  • D

    Mark the message as a "Draft".

  • F

    Mark the message as "Flagged".

You can also specify the queue to which the message will be moved:

  • Missing or undefined

    Move the message to cur.

  • tmp

    Move the message to tmp.

  • new

    Move the message to new.

  • cur

    Move the message to cur.

  • keepq

    Keep the message in the same queue, do not move it.

CHECKING MESSAGE STATE

The following methods can be used to quickly check for specific message state flags.

$message->flags()

Returns a string containing all the flags set for the current message.

$message->passed()

Returns 1 if the message currently has the "Passed" flag set.

$message->replied()

Returns 1 if the message has been replied to.

$message->seen()

Returns 1 if a client has read the current message.

$message->trashed()

Returns 1 if the message is currently trashed after one helluva wild night with its best buds.

$message->draft()

Returns 1 if the message is a draft.

$message->flagged()

Returns 1 if the message is flagged as important.

AUTHOR

Alexandra Hrefna Hilmisdóttir <xan@cpan.org>

COPYRIGHT

Copyright (c) 2016, cPanel, Inc. Distributed under the terms of the MIT license. See the LICENSE file for further details.

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 257:

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

Around line 345:

Non-ASCII character seen before =encoding in 'Hilmisdóttir'. Assuming UTF-8