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

Class: Mail_Mbox

Source Location: /Mail_Mbox-0.1.4/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 162]
Mbox PHP class to Unix MBOX parsing and using

LICENSE (LGPL) Copyright (C) 2002-2003 Roberto Berto This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Or at http://www.gnu.org/licenses/lgpl.txt

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 183]

Debug mode

Set to true to turn on debug mode

  • Access: public

Type:   bool


[ Top ]



Method Detail

close   [line 231]

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 270]

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 411]

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 197]

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 309]

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

[ Top ]

size   [line 253]

int size( int $resourceId)

Mbox Size

Get Mbox Number of Messages

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

Parameters:

int   $resourceId     Mbox resouce id created by open

[ Top ]

update   [line 358]

mixed update( int $resourceId, int $message, string $content)

Update a message

Note: PEAR::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 Fri, 30 Apr 2004 22:02:19 +0200 by phpDocumentor 1.2.3. PEAR Logo Copyright © PHP Group 2004.