views:

12

answers:

1

Is it possible to retrieve the complete message source (similar tu Unix Mbox format) using Zend_Mail_Storage_Pop3 from the Zend Framework?

I'm using the following code to retrieve messages:

  $mail = new Zend_Mail_Storage_Pop3(array('host'     => 'localhost',
                                           'user'     => 'test',
                                           'password' => 'test'));
  echo $mail->countMessages() . " messages found\n";
  foreach ($mail as $message) {
      echo "Mail from '{$message->from}': {$message->subject}\n";
  }

It looks like the $mail object contains the message already split up into fields (ie. headers, contents, etc.). Is there any way to retrieve the original message source? I would like to be able to store it so if I need to parse the message again using a different tool, I will have the necessary information.

A: 

For now I'm trying to use the following code:

<?php
foreach ($mail as $messageNumber => $message) {
    echo $mail->getRawHeader($messageNumber);
    echo $mail->getRawContent($messageNumber);
}
?>
pako