PHP code example of armin / mbox-parser

1. Go to this page and download the library: Download armin/mbox-parser library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

armin / mbox-parser example snippets




$page = 1;
$itemsPerPage = 10;

$parser = new \Armin\MboxParser\Parser();
$mailbox = $parser->parse('path/to/file.mbox', $page, $itemsPerPage);

// $mailbox only contains the items from given page 
foreach ($mailbox as $mailMessage) {
    // ...
}



$parser = new \Armin\MboxParser\Parser();
$total = $parser->getTotalEntries('path/to/file.mbox');



$parser = new \Armin\MboxParser\Parser();
$mailMessage = $parser->getMessageById('path/to/file.mbox', '[email protected]')