Source for file modify.php
Documentation is available at modify.php
require_once 'Mail/Mbox.php';
//This function just lists all subjects
echo 'Mbox has ' . $mbox->size () . ' messages.' . "\n";
for ($n = 0; $n < $mbox->size (); $n++ ) {
$message = $mbox->get ($n);
preg_match('/Subject: (.*)$/m', $message, $matches);
echo 'Mail #' . $n . ': ' . $subject . "\n";
//make a copy of the demo file
$original = dirname(__FILE__ ) . '/demobox';
$file = tempnam('/tmp', 'mbox-copy-');
echo 'Using file ' . $file . "\n";
echo 'append a message to the end of the box' . "\n";
$message = $mbox->get (0 ) . "\n" . 'This is a copy of the mail';
echo 'insert a message before the second message' . "\n";
$message = $mbox->get (0 ) . "\n" . 'This is another copy of the mail';
$mbox->insert ($message, 1 );
echo 'remove the last message' . "\n";
echo 'remove the first two messages' . "\n";
$mbox->remove (array (0 , 1 ));
Documentation generated on Mon, 11 Mar 2019 15:35:10 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|