Path

ez components / documentation / api reference / 2007.1.1 / mail


eZ Components 2007.1.1

Mail: ezcMailStorageSet

[ Tutorial ] [ Display example ] [ Mail listing example ] [ Rfcs ] [ Class tree ] [ Element index ] [ ChangeLog ] [ Credits ]

Class: ezcMailStorageSet

ezcMailStorageSet is a wrapper around other mail sets and provides saving of mail sources to files. [source]

Implemented Interfaces

Example:
 1.  // create a new POP3 transport object and a mail parser object
 2.   $transport new ezcMailPop3Transport"server" );
 3.  $transport->authenticate"username""password" );
 4.  $parser new ezcMailParser();
 5.  
 6.  // wrap around the set returned by fetchAll()
 7.  // and specify that the sources are to be saved in the folder /tmp/cache
 8.   $set new ezcMailStorageSet$transport->fetchAll()'/tmp/cache' );
 9.  
10.  // parse the storage set
11.   $mail $parser->parseMail$set );
12.  
13.  // get the filenames of the saved mails in the set
14.  // this must be saved somewhere so it can be used on a subsequent request
15.   $files $set->getSourceFiles();
16.  
17.  // get the source of a the 4th saved mail
18.  // this can be on a subsequent request if the $files array was saved from
19.  // a previous request
20.   $source file_get_contents$files[3);

Method Summary

public ezcMailStorageSet __construct( $set, $location )
Constructs a new storage set around the provided set.
public void __destruct( )
Destructs the set.
public string getNextLine( )
Returns one line of data from the current mail in the set.
public array(string) getSourceFiles( )
Returns an array of the filenames holding the sources of the mails in this set.
public bool hasData( )
Returns whether the set has mails.
public bool nextMail( )
Moves the set to the next mail and returns true upon success.

Methods

__construct

ezcMailStorageSet __construct( ezcMailParserSet $set, string $location )
Constructs a new storage set around the provided set.
$location specifies where to save the message sources. This directory MUST exist and must be writable.

Parameters

Name Type Description
$set ezcMailParserSet  
$location string  

__destruct

void __destruct( )
Destructs the set.
Closes any open files.

getNextLine

string getNextLine( )
Returns one line of data from the current mail in the set.
Null is returned if there is no current mail in the set or the end of the mail is reached,
It also writes the line of data to the current file. If the line contains a Message-ID header then the value in the header will be used to rename the file.

getSourceFiles

array(string) getSourceFiles( )
Returns an array of the filenames holding the sources of the mails in this set.
The format of the returned array is: array( 0 => 'location/filename1', 1 => 'location/filename2',...)

hasData

bool hasData( )
Returns whether the set has mails.

nextMail

bool nextMail( )
Moves the set to the next mail and returns true upon success.
False is returned if there are no more mail in the set.

Last updated: Wed, 28 Nov 2007