Home » Mail » Mail_Mime » Bug #5617
Explain that order of method calls get() and headers() of Mail_mime matter
Details
| Doc Bug #5617 | Explain that order of method calls get() and headers() of Mail_mime matter |
|---|---|
| Submitted | 2005-10-06 15:47 UTC |
| From | me at thomaskeller dot biz |
| Assigned | cipri |
| Status | Closed |
| Package | Mail_Mime |
| PHP Version | 4.3.11 |
| OS | Windows 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..