Ejemplo n.º 1
0
 public function testPop3MessageSource()
 {
     $transport = new ezcMailPop3Transport("mta1.ez.no");
     $transport->authenticate("*****@*****.**", "ezcomponents");
     $parser = new ezcMailParser();
     $set = new ezcMailStorageSet($transport->fetchByMessageNr(1), $this->tempDir);
     $mail = $parser->parseMail($set);
     $files = $set->getSourceFiles();
     $source = file_get_contents($files[0]);
     $this->assertEquals(self::$sizes[0], strlen($source));
 }
Ejemplo n.º 2
0
 public function testFetchByMessageNr3()
 {
     $pop3 = new ezcMailPop3Transport(self::$server);
     $pop3->authenticate(self::$user, self::$password);
     $message = $pop3->fetchByMessageNr(1);
     $parser = new ezcMailParser();
     $mail = $parser->parseMail($message);
     $this->assertEquals(1, count($mail));
     $this->assertEquals(array(0 => '1'), $this->readAttribute($message, 'messages'));
     $this->assertEquals('ezcMailPop3Set', get_class($message));
 }
<?php

require_once "extension/jaj_newsletter/lib/bounce_handler/bounce_driver.class.php";
$server = "zmail-01.hikt.no";
$username = "******";
$password = "******";
$bouncehandler = new Bouncehandler();
$pop3 = new ezcMailPop3Transport($server);
$pop3->authenticate($username, $password);
$pop3->status($num, $size);
$cli->output('Bounce messages to check: ' . $num);
$messages = $pop3->listMessages();
foreach ($messages as $index => $size) {
    $set = $pop3->fetchByMessageNr($index);
    do {
        $raw_message = "";
        $line = "";
        while (($line = $set->getNextLine()) !== null) {
            $raw_message .= $line;
        }
        $result = $bouncehandler->get_the_facts($raw_message);
        $result = $result[0];
        $status = $result['status'];
        $action = $result['action'];
        $recipient = trim($result['recipient']);
        if (!in_array($action, array("delayed", "failed", "autoreply"))) {
            $cli->output("Message index: {$index}, unknown action: {$action}, skipping...");
            continue;
        }
        if ($action == 'delayed' || $action == 'autoreply') {
            $cli->output("Deleting message: {$index}, action: {$action}");
Ejemplo n.º 4
0
require_once 'tutorial_autoload.php';
// Create a new POP3 transport object by specifying the server name
$pop3 = new ezcMailPop3Transport("pop3.example.com");
// Authenticate to the POP3 server
$pop3->authenticate("user", "password");
// Get the number of messages on the server and their combined size
// in the variables $num and $size
$pop3->status($num, $size);
// Get the list of message numbers on the server and their sizes
// the returned array is something like: array( 1 => 1500, 2 => 45200 )
// where the key is a message number and the value is the message size
$messages = $pop3->listMessages();
// Get the list of message unique ids on the server and their sizes
// the returned array is something like: array( 1 => '00000f543d324', 2 => '000010543d324' )
// where the key is an message number and the value is the message unique id
$messages = $pop3->listUniqueIdentifiers();
// Usually you will call one of these 3 fetch functions:
// Fetch all messages on the server
$set = $pop3->fetchAll();
// Fetch one message from the server (here: get the message no. 2)
$set = $pop3->fetchByMessageNr(2);
// Fetch a range of messages from the server (here: get 4 messages starting from message no. 2)
$set = $pop3->fetchFromOffset(2, 4);
// Delete a message from the server
$pop3->delete(1);
// Use this to keep the connection alive
$pop3->noop();
// Create a new mail parser object
$parser = new ezcMailParser();
// Parse the set of messages retrieved from the server earlier
$mail = $parser->parseMail($set);