Issues

ZF-1491: Impossible to get decoded Mime_Part after Zend_Mime_Message::createFromMessage

Description

After decoding a mime string using Zend_Mime_Message::createFromMessage, it is impossible to get to one Part's body since 1) ->_content is protected and 2) getContent() tries to encode it a second time, instead of decoding it properly.

Comments

Assign to Nico.

This will be fixed with the merge of Zend_Mime_Message and Zend_Mail_Message.

In the meanwhile if you want to read a mail message you could use Zend_Mail_Message:


<?php
$message = new Zend_Mail_Message('file' => '/path/to/message/file');
// or
$message = new Zend_Mail_Message('raw' => ... message string ...);

// get header
echo $message->subject, ' from ', $message->from;

// get content
if ($message->isMultipart()) {
  foreach (new RecursiveIteratorIterator($message) as $part) {
    echo $part->contentType, ': ', $part->getContent();
  }
} else {
  echo $message->getContent();
  // or with 5.2
  echo $message;
}

I hope you're not making Zend_Mime_Message tailored only to mail. MIME is used for things other than e-mail, like MM7-encoded MMS messages.

By the way, what's the status of this? It's been nearly a year.

This issue is still open and still applies to the current trunk. I suppose there won't be a fix in zf1 since it will cause BC breaks, are there any plans to address this in ZF2?

Added a getRawContent() method to Zend_Mime_Part to retrieve unencoded values in r23713 in trunk and 23714 in release branch 1.11