Skip to content
Snippets Groups Projects
Commit c27bf65f authored by Peter Rotich's avatar Peter Rotich
Browse files

Mime encode attachments to uft-8

parent 83c2f0f4
No related branches found
No related tags found
No related merge requests found
......@@ -164,6 +164,11 @@ class Mail_Parse {
return $data;
}
function mime_encode($text, $charset=null, $encoding='utf-8') {
return Format::encode($text, $charset, $encoding);
}
function getAttachments($part=null){
if($part==null)
......@@ -173,10 +178,20 @@ class Mail_Parse {
&& (!strcasecmp($part->disposition,'attachment')
|| !strcasecmp($part->disposition,'inline')
|| !strcasecmp($part->ctype_primary,'image'))){
if(!($filename=$part->d_parameters['filename']) && $part->d_parameters['filename*'])
$filename=$part->d_parameters['filename*']; //Do we need to decode?
$file=array(
'name' => $filename,
'type' => strtolower($part->ctype_primary.'/'.$part->ctype_secondary),
'data' => $this->mime_encode($part->body, $part->ctype_parameters['charset'])
);
if(!$this->decode_bodies && $part->headers['content-transfer-encoding'])
$file['encoding'] = $part->headers['content-transfer-encoding'];
return array(array('filename'=>$filename,'body'=>$part->body));
return array($file);
}
$files=array();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment