Mime_Mail: calling headers() before get()?
| From: | Robert P. J. Day | Date: | Thu, 25 Feb 2010 19:07:39 +0000 |
| Subject: | Mime_Mail: calling headers() before get()? | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-30321@lists.php.net to get a copy of this message | ||
on this documentation page showing sample usage of the Mail_Mime
class:
http://pear.php.net/manual/en/package.mail.mail-mime.example.php
the example seems pretty clear what you shouldn't do:
...
//do not ever try to call these lines in reverse order
$body = $mime->get();
$hdrs = $mime->headers($hdrs);
...
however, if you read the actual class code, you read:
function &headers($xtra_headers = null, $overwrite = false, $skip_content = false)
{
// Add mime version header
$headers['MIME-Version'] = '1.0';
// Content-Type and Content-Transfer-Encoding headers should already
// be present if get() was called, but we'll re-set them to make sure
// we got them when called before get() or something in the message
// has been changed after get() [#14780]
so that comment seems to be a little more forgiving and suggests that
you *can* call headers() before get(), but only if done carefully and
under certain circumstances.
perhaps this ordering issue could be explained more clearly.
rday
--
========================================================================
Robert P. J. Day Waterloo, Ontario, CANADA
Linux Consulting, Training and Kernel Pedantry.
Web page: http://crashcourse.ca
Twitter: http://twitter.com/rpjday
========================================================================