suggested extra method for Mail_mimeDecode - integrate with Mail::send...
| From: | Alan Knowles | Date: | Fri, 14 Jun 2002 09:18:07 +0000 |
| Subject: | suggested extra method for Mail_mimeDecode - integrate with Mail::send... | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-7009@lists.php.net to get a copy of this message | ||
I was looking at sending templated mail, using the pear classes - it seems this method would be usefull to integrate the other Mail classes:
This is what I was looking to doing...
$mailtext = $MyFavouriteTemplateEngine->getResult();
$decoder = new Mail_mimeDecode($mailtext);
list($recipient,$headers,$body) = $decoder->getSendArray();
$mail = Mail::factory('smtp');
$mail->send($recipient,$headers,$body);
the getSendArray() would then be..
function getSendArray()
{
$headerlist =$this->_parseHeaders();
$to = "";
if ($headerlist)
foreach($headerlist as $item) {
$header[$item['name']] = $header[$item['value']]
switch (strtolower($item['name']))
case "to":
case "cc":
case "bcc":
$to = ",".$item['value'];
default:
break;
}
}
$to = substr($to,1);
return array($to,$headerlist,$this->_body);
}
any objections to adding?????