# Mailbox Classes

## `class TMail::MhMailbox`

The class to handle MH mailboxes.

### Class Methods

`new(dirname)` -> `TMail::MhMailbox`

  dirname: String

  creates new MhMailbox object. DIRNAME must be valid MH mailbox directory.

### Instance Methods

`each_port {|port| .... }`
`each {|port| .... }`

  port: TMail::FilePort

  iterates for each mail in the mailbox, in assendant order (older mail first).

`reverse_each_port {|port| .... }`
`reverse_each {|port| .... }`

  port: TMail::FilePort

  iterates for each mail in the mailbox, in descendant order (newer mail first).

`last_atime` -> `Time`
`last_atime=(time)`

  time: Time

  The time which last each_new_port/each_port/reverse_each_port is called.

`each_new_port(time = last_atime()) {|port| .... }`

  time: Time
  port: TMail::FilePort

  iterates for each mails in mailbox, which are newer than TIME.

`new_port` -> `TMail::FilePort`

  creates a new file in the mailbox and returns its port.

`close`

  does nothing.

## `class TMail::UNIXMbox`

The class to handle UNIX mbox. Current implementation creates temporary MH mbox.

### Class Methods

`new(filename)` -> `TMail::UNIXMbox`

  filename: String

  creates new TMail::UNIMbox object. FILENAME must be valid UNIX mbox file name.

### Instance Methods

`each_port {|port| .... }`
`each {|port| .... }`

  port: TMail::FilePort

  iterates for each mail in the mailbox, in assendant order (older mail first).

`reverse_each_port {|port| ... }`
`reverse_each {|port| ... }`

  port: TMail::FilePort

  iterates for each mail in the mailbox, in descendant order (newer mail first).

`each_new_port(time = @last_loaded_time) {|port| .... }`

  time: Time
  port: TMail::FilePort

  iterates for each mails in mailbox, which are newer than TIME. @last_loaded_time is updated when each_new_port/each_port is called.

`new_port` -> `TMail::FilePort`

  creates a new file in the mailbox and returns its port.

`close`

  forces an UNIXMbox to write back mails to real mbox file. Once this method is called, any method calls causes to raise IOError exception.

## `class TMail::Maildir`

The class to handle "maildir" mailbox.

### Class Methods

`new(dirname)` -> `TMail::Maildir`

  dirname: String

  creates new TMail::Maildir object. DIRNAME must be valid maildir.

### Instance Methods

`each_port {|port| .... }`
`each {|port| .... }`

  port: TMail::FilePort

  iterates for each mail in the mailbox, in assendant order (older mail first).

`reverse_each_port {|port| .... }`
`reverse_each {|port| .... }`

  port: TMail::FilePort

  iterates for each mail in the mailbox, in descendant order (newer mail first).

`each_new_port {|port| .... }`

  port: TMail::FilePort

  iterates for each mails in MAILDIR/new.

`new_port` -> `TMail::FilePort`

  creates a new file in the mailbox and returns its port.