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

Issue Type: Bug Created: 2007-06-04T17:02:29.000+0000 Last Updated: 2011-02-17T13:45:07.000+0000 Status: Resolved Fix version(s): - 1.11.4 (03/Mar/11)

Reporter: Florian Hoenig (flo) Assignee: Ralph Schindler (ralph) Tags: - Zend_Mime

Related issues: Attachments:


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.


Posted by Bill Karwin (bkarwin) on 2007-06-07T11:22:55.000+0000

Assign to Nico.

Posted by Nico Edtinger (nico) on 2007-06-10T07:06:39.000+0000

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:

<pre class="highlight">
$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;

Posted by Matthew Ratzloff (mratzloff) on 2008-04-03T15:07:44.000+0000

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.

Posted by Martin de Keijzer (martin1982) on 2010-12-24T14:33:47.000+0000

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?

Posted by Ralph Schindler (ralph) on 2011-02-17T13:45:06.000+0000

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

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.