PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Mail » Mail_Mime » Bug #5617

Explain that order of method calls get() and headers() of Mail_mime matter

Details

Doc Bug #5617Explain that order of method calls get() and headers() of Mail_mime matter
Submitted2005-10-06 15:47 UTC
Fromme at thomaskeller dot biz
Assignedcipri
StatusClosed
PackageMail_Mime
PHP Version4.3.11
OSWindows 2000
Roadmaps(Not assigned)

Comments

[2005-10-06 15:47 UTC] me at thomaskeller dot biz

Description:
------------
The example for Mail_mime contains this code snippet:

$body = $mime->get();
$hdrs = $mime->headers($hdrs);

While both function calls don't seem to be dependent
from a first view, they are. After I crawled through the
sourcecode for over an hour I found that get() calls
Mail_mimePart's encode() where boundaries for certain
parts of the email are dynamically created. If you now
retrieve the headers before this encoding action, you
won't gain the needed "Content-type: multipart/alternative;
boundary=\"some_random_boundary\"" header and - effectively - the example doesn't work out at all (both mime parts are
displayed under another).

IMHO the docs should at least state that it won't work
the other way around, better would be to change the
implementation so that headers() returns an error as long
as encode() or get() isn't called. Something along this
line.

[2005-10-06 15:48 UTC] me at thomaskeller dot biz

changed summary

[2006-10-31 16:50 UTC] pear at pk dot iolab dot de

definitly agree on this, this should be pointed out more clearly in the docs. i was getting mad trying to figure out why the mail wouldn't display as an html-mail..

thanks anyway for this great class..