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

Class: Mail_Mbox

Source Location: /Mail_Mbox-0.2.0/mbox.php

Class Overview

PEAR
   |
   --Mail_Mbox

Mbox PHP class to Unix MBOX parsing and using


Author(s):

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 145]
Mbox PHP class to Unix MBOX parsing and using

METHODS: int resource mbox->open(string file) open a mbox and return a resource id

bool mbox->close(resource) close a mbox resource id

int mbox->size(resource) return mbox number of messages

string mbox->get(int resource, messageNumber) return the message number of the resource

bool mbox->update(int resource, int messageNumber, string message) update the message offset to message (need write permission)

bool mbox->remove(int resource, int messageNumber) remove the message messageNumber (need write permission)

bool mbox->insert(int resource, string message[, $offset = null]) add message to the end of the mbox. Offset == 0 message will be append at first message. If after == null will be the last one message. (need write permission)

RELATED LINKS:

  • CPAN Perl Mail::Folder::Mbox Module Used as a start point to create this class. http://search.cpan.org/author/KJOHNSON/MailFolder-0.07/Mail/Folder/Mbox.pm
  • PHP Mime Decode PEAR Module Use it to parse headers and body. http://pear.php.net/package-info.php?pacid=21
EXAMPLE:



[ Top ]


Class Variables

$debug =  false

[line 166]

Debug mode

Set to true to turn on debug mode

  • Access: public

Type:   bool


[ Top ]



Method Detail

close   [line 214]

mixed close( int $resourceId)

Close a Mbox

Close the Mbox file opened by open()

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

Parameters:

int   $resourceId   —  Mbox resouce id created by open

[ Top ]

get   [line 258]

string get( int $resourceId, int $message)

Mbox Get

Get a Message from Mbox

Note: Message number start from 0.

  • Return: Return the message else pear error class
  • Access: public

Parameters:

int   $resourceId   —  Mbox resouce id created by open
int   $message   —  The number of Message

[ Top ]

insert   [line 414]

mixed insert( int $resourceId, 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.

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

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

Parameters:

int   $resourceId   —  Mbox resouce id created by open
string   $content   —  The content of the new Message
int   $offset   —  offset Before the offset. Default: last message

[ Top ]

open   [line 180]

mixed open( int $file)

Open a Mbox

Open the Mbox file and return an resource identificator.

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

  • Return: ResourceID on success else pear error class
  • Access: public

Parameters:

int   $file   —  Mbox file to open

[ Top ]

remove   [line 300]

mixed remove( int $resourceId, int $message)

Delete Message

Remove a message from Mbox and save it.

Note: messages start with 0.

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

Parameters:

int   $resourceId   —  Mbox resouce id created by open
int   $message   —  The number of Message to remove, or array of message ids to remove

[ Top ]

size   [line 237]

int size( int $resourceId)

Mbox Size

Get Mbox Number of Messages

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

Parameters:

int   $resourceId   —  Mbox resouce id created by open

[ Top ]

update   [line 361]

mixed update( int $resourceId, 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 else pear error class
  • Access: public

Parameters:

int   $resourceId   —  Mbox resouce id created by open
int   $message   —  The number of Message to updated
string   $content   —  The new content of the Message

[ Top ]


Documentation generated on Mon, 11 Mar 2019 13:57:03 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.