Home » Mail » Mail_Mime » Bug #3490
mime->headers; change merge order
Details
| Request #3490 | mime->headers; change merge order |
|---|---|
| Submitted | 2005-02-16 12:12 UTC |
| From | wouter dot monkhorst at gmail dot com |
| Status | Bogus |
| Package | Mail_Mime |
| PHP Version | 5.0.2 |
| Roadmaps | (Not assigned) |
Comments
[2005-02-16 12:12 UTC] wouter dot monkhorst at gmail dot com
Description:
------------
When reusing the mime object in a loop, the header cannot be updated with a new 'To' field, see 'reproduce code'.
A change of order in the array_merge would solve this problem:
file: mime.php, line: 536 - 556
function &headers($xtra_headers = null)
{
// Content-Type header should already be present,
// So just add mime version header
$headers['MIME-Version'] = '1.0';
if (isset($xtra_headers)) {
$headers = array_merge($headers, $xtra_headers);
}
$this->_headers = array_merge($this->_headers, $headers);
return $this->_encodeHeaders($this->_headers);
}
Reproduce code:
---------------
$mime->setHTMLBody($html);
$body = $mime->get();
foreach ($recipients as $user_id=>$recipient) {
$hdrs_arr = array('Subject' => $subject,
'From' => $from,
'To' => $recipient);
$hdrs = $mime->headers($hdrs_arr);
print_r($hdrs);
$this->send($recipient, $hdrs, $body);
}
Expected result:
----------------
[2005-02-18 10:00 UTC] wouter dot monkhorst at gmail dot com
this feature request equals request#2952 (http://pear.php.net/bugs/2952)