public function testFetchMailUnknownCharsets() { $mbox = new ezcMailMboxTransport(dirname(__FILE__) . "/data/unknown-charsets.mbox"); $set = $mbox->fetchAll(); $parser = new ezcMailParser(); $mail = $parser->parseMail($set); $this->assertEquals("x-user-defined", $mail[0]->body->originalCharset); $this->assertEquals("utf-8", $mail[0]->body->charset); $this->assertEquals("Tämä on testiöö1", trim($mail[0]->body->text)); $this->assertEquals("unknown-8bit", $mail[1]->body->originalCharset); $this->assertEquals("utf-8", $mail[1]->body->charset); $this->assertEquals("Tämä on testiöö2", trim($mail[1]->body->text)); }
public function testMboxMessageEmpty() { $transport = new ezcMailMboxTransport(dirname(__FILE__) . "/data/empty.mbox"); $parser = new ezcMailParser(); $set = new ezcMailStorageSet($transport->fetchAll(), $this->tempDir); $mail = $parser->parseMail($set); $this->assertEquals(0, count($mail)); }
public function testDraft1Bcc() { $mbox = new ezcMailMboxTransport(dirname(__FILE__) . "/data/drafts/postponed-msgs-pine.mbox"); $set = $mbox->fetchAll(); $parser = new ezcMailParser(); $mail = $parser->parseMail($set); $this->assertEquals(1, count($mail)); $this->assertEquals(array(new ezcMailAddress('*****@*****.**', 'Sebastian Bergmann', 'utf-8')), $mail[0]->bcc); }
<?php require_once 'tutorial_autoload.php'; // Create a new Mbox transport object by specifiying an existing mbox file name $mbox = new ezcMailMboxTransport("/path/file.mbox"); // Fetch all messages from the mbox file $set = $mbox->fetchAll(); // Create a new mail parser object $parser = new ezcMailParser(); // Parse the set of messages retrieved from the mbox file earlier $mail = $parser->parseMail($set);