NAME

Mail::POP3::Folder::mbox - class that handles an mbox-format mailbox for POP3

SYNOPSIS

my $mailbox = Mail::POP3::Folder::mbox->new(
    $user_id,
    $mbox_path,
    '^From ',
    '^\\s*$',
);
die "Could not acquire lock\n" unless $mailbox->lock_acquire;
$mailbox->uidl_list(\*STDOUT);
print $mailbox->uidl(2), "\n";
$mailbox->delete(2);
$mailbox->top(3, \*STDOUT, 2);
$mailbox->retrieve(3, \*STDOUT);
print $mailbox->octets(1), "\n";
$mailbox->flush_delete;
$mailbox->lock_release;

DESCRIPTION

This class manages an mbox-format mailbox in accordance with the requirements of a POP3 server.

METHODS

$class->new($user_id, $mbox_path, $message_start, $message_end)

Returns an object.

$mailbox->lock_acquire

Acquires a lock on the mailbox.

$mailbox->lock_release

Releases the lock on the mailbox.

$mailbox->octets

Returns the number of octets in all non-deleted messages.

$mailbox->messages

Returns the number of non-deleted messages.

$mailbox->flush_delete

Actually deletes all messages marked as deleted. Throws an exception if the spool-file was modified since the lock was acquired.

$mailbox->reset

$mailbox->top($message, $output_fh, $body_lines)

Prints the header and top $body_lines lines of the given message to the given file-handle. It does not produce a final ".$CRLF".

$mailbox->retrieve($message, $output_fh, $mbox_destined)

Prints the given message to the given file-handle. It does not produce a final ".$CRLF". If $mbox_destined is true, then ends each line with LF, not CRLF, and do not byte-stuff the . character.

$mailbox->uidl_list($output_fh)

Prints a list of all message numbers and their UIDLs to the given file-handle. It does produce a final ".$CRLF".

$mailbox->uidl($message)

Returns the persistent unique ID for the given message.

$mailbox->is_deleted($message)

Returns true if the given message has been marked as deleted.

$mailbox->is_valid($message)

Returns true if the given message has NOT been marked as deleted and is within the range of messages in the mailbox.

$mailbox->delete($message)

Marks the given message as deleted.

SEE ALSO

RFC 1939, Mail::POP3.