apidoc
[ class tree: apidoc ] [ index: apidoc ] [ all elements ]

Class: Mail_Mbox

Source Location: /Mail_Mbox-0.5.0/Mail/Mbox.php

Class Overview

PEAR
   |
   --Mail_Mbox

Class to read mbox mail files.


Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 26]
Class to read mbox mail files.


[ Top ]


Class Variables

$debug =  false

[line 60]

Debug mode

Set to true to turn on debug mode

  • Access: public

Type:   bool


[ Top ]

$tmpdir =  '/tmp'

[line 72]

Directory in which the temporary mbox files are created.

Even if it's a unix directory, it does work on windows as the only function it's used in is tempnam which automatically chooses the right temp directory if this here doesn't exist. So this variable is for special needs only.

  • Access: public

Type:   string


[ Top ]

$_index =  null

[line 42]

Message index
  • Access: protected

Type:   array


[ Top ]

$_lastModified =  null

[line 50]

Timestamp at which the file has been modified last
  • Access: protected

Type:   int


[ Top ]

$_resource =  null

[line 34]

File resource / handle
  • Access: protected

Type:   resource


[ Top ]



Method Detail

Mail_Mbox (Constructor)   [line 83]

Mail_Mbox Mail_Mbox( string $file)

Create a new Mbox class instance.

After creating it, you should use open().

  • Access: public

Parameters:

string   $file     Filename to open.

[ Top ]

close   [line 124]

mixed close( )

Close a Mbox

Close the Mbox file opened by open()

  • Return: true on success, else PEAR_Error
  • Access: public

[ Top ]

get   [line 162]

string get( int $message)

Get a message from the mbox

Note: Message number start from 0.

  • Return: Return the message, PEAR_Error on error
  • Access: public

Parameters:

int   $message     The number of Message

[ Top ]

hasBeenModified   [line 465]

boolean hasBeenModified( )

Checks if the file was modified since it has been loaded.

If this is true, the file needs to be re-opened.

  • Return: True if it has been modified.
  • Access: public

[ Top ]

insert   [line 317]

mixed insert( string $content, [int $offset = null])

Insert a message

PEAR::Mail_Mbox will insert the message according its offset.

  1. means before the actual message 0. 3 means before the message 3
(Remember: message 3 is the forth message). The default is put AFTER the last message (offset = null).

Note: PEAR::Mail_Mbox auto adds \n\n at end of the message

  • Return: Return true else pear error class
  • Access: public

Parameters:

string   $content     The content of the new message
int   $offset     offset Before the offset. Default: last message (null)

[ Top ]

open   [line 96]

void open( )

Open the mbox file

Also, this function will process the Mbox and create a cache that tells each message start and end bytes.

  • Access: public

[ Top ]

remove   [line 200]

mixed remove( int $message)

Remove a message from Mbox and save it.

Note: messages start with 0.

  • Return: Return true else PEAR_Error
  • Access: public

Parameters:

int   $message     The number of the message to remove, or array of message ids to remove

[ Top ]

size   [line 144]

int size( )

Get number of messages in this mbox
  • Return: Number of messages on Mbox (starting on 1,
    1. if no message exists)
  • Access: public

[ Top ]

update   [line 263]

mixed update( int $message, string $content)

Update a message

Note: Mail_Mbox auto adds \n\n at end of the message

Note: messages start with 0.

  • Return: Return true if all is ok, else PEAR_Error
  • Access: public

Parameters:

int   $message     The number of Message to updated
string   $content     The new content of the Message

[ Top ]

_move   [line 373]

void _move( mixed $ftempname, string $filename)

Copy a file to another

Used internally to copy the content of the temp file to the mbox file

  • Access: protected

Parameters:

string   $filename     Output file

[ Top ]

_process   [line 411]

void _process( )

Process the Mbox

  • Get start bytes and end bytes of each messages

  • Access: protected

[ Top ]


Documentation generated on Sun, 25 Jun 2006 06:06:37 -0400 by phpDocumentor 1.2.3. PEAR Logo Copyright © PHP Group 2004.