Class Larch::IMAP::Mailbox
In: lib/larch/imap/mailbox.rb
Parent: Object

Represents an IMAP mailbox.

Methods

Constants

FETCH_BLOCK_SIZE = 1024   Maximum number of message headers to fetch with a single IMAP command.
REGEX_MESSAGE_ID = /message-id\s*:\s*(\S+)/i   Regex to capture a Message-Id header.
SCAN_INTERVAL = 60   Minimum time (in seconds) allowed between mailbox scans.

Attributes

attr  [R] 
db_mailbox  [R] 
delim  [R] 
flags  [R] 
imap  [R] 
name  [R] 
perm_flags  [R] 
state  [R] 
subscribed  [R] 

Public Class methods

Public Instance methods

<<(message)

Alias for append

[](guid, peek = false)

Alias for fetch

Appends the specified Larch::IMAP::Message to this mailbox if it doesn‘t already exist. Returns true if the message was appended successfully, false if the message already exists in the mailbox.

Deletes the message in this mailbox with the specified guid. Returns true on success, false on failure.

Iterates through messages in this mailbox, yielding a Larch::Database::Message object for each to the provided block.

Iterates through messages in this mailbox, yielding the Larch message guid of each to the provided block.

Iterates through mailboxes that are first-level children of this mailbox, yielding a Larch::IMAP::Mailbox object for each to the provided block.

Expunges this mailbox, permanently removing all messages with the \Deleted flag.

Returns a Larch::IMAP::Message struct representing the message with the specified Larch guid, or nil if the specified guid was not found in this mailbox.

Returns a Larch::Database::Message object representing the message with the specified Larch guid, or nil if the specified guide was not found in this mailbox.

Returns true if a message with the specified Larch guid exists in this mailbox, false otherwise.

Gets the number of messages in this mailbox.

Returns an Array of Larch::IMAP::Mailbox objects representing mailboxes that are first-level children of this mailbox.

Same as fetch, but doesn‘t mark the message as seen.

Resets the mailbox state.

Fetches message headers from this mailbox.

Sets the IMAP flags for the message specified by guid. flags should be an array of symbols for standard flags, strings for custom flags.

If merge is true, the specified flags will be merged with the message‘s existing flags. Otherwise, all existing flags will be cleared and replaced with the specified flags.

Note that the :Recent flag cannot be manually set or removed.

Returns true on success, false on failure.

size()

Alias for length

Subscribes to this mailbox.

Returns true if this mailbox is subscribed, false otherwise.

Unsubscribes from this mailbox.

[Validate]