作者 邓超

x

... ... @@ -118,6 +118,10 @@ class Body {
}else{
if(isset($header['Content-Transfer-Encoding'])){
$body = $this->decode($header['Content-Transfer-Encoding'],$body);
}
$this->setItem(['type'=>'text/plain','body'=>$body]);
}
... ... @@ -345,31 +349,7 @@ class Body {
}else{
// tag
$data['body'] = $tempbody;
// body解密
switch($data['encode']??''){
case 'base64': {
$data['body'] = base64_decode($data['body']);
break;
}
case 'quoted-printable': {
$data['body'] = quoted_printable_decode($data['body']);
break;
}
case '8bit': {
try {
// $data['body'] = DeCoding::de8bit($data['body']);
// 暂时没有替换 imap_8bit的函数
$data['body'] = imap_8bit($data['body']);
$data['body'] = quoted_printable_decode($data['body']);
}catch (\Throwable $e){
}
break;
}
}
$data['body'] = $this->decode($data['encode']??'',$tempbody);
// 转码
// if(isset($data['charset']) && $data['charset']){
... ... @@ -400,6 +380,32 @@ class Body {
}
private function decode($code,$body){
switch($code){
case 'base64': {
$data['body'] = base64_decode($body);
break;
}
case 'quoted-printable': {
$data['body'] = quoted_printable_decode($body);
break;
}
case '8bit': {
try {
// $data['body'] = DeCoding::de8bit($data['body']);
// 暂时没有替换 imap_8bit的函数
$body = imap_8bit($body);
$body = quoted_printable_decode($body);
}catch (\Throwable $e){
}
break;
}
}
return $body;
}
/**
* 解析文件
... ...