...
|
...
|
@@ -254,6 +254,10 @@ class Body { |
|
|
// $filename = MailFun::decodeMimeStr($filename[1]);
|
|
|
$filename = mb_decode_mimeheader($filename[1]);
|
|
|
}
|
|
|
// 附件
|
|
|
if(stripos($item,'Content-Disposition: attachment;')!==false){
|
|
|
$isfileattachment = 1;
|
|
|
}
|
|
|
|
|
|
|
|
|
// 删除不需要的tag属性,如果需要进进行解析
|
...
|
...
|
@@ -270,39 +274,44 @@ class Body { |
|
|
}
|
|
|
// 是文本还是附件
|
|
|
else if(strpos($data['type'],'text/') === 0 ){
|
|
|
// tag
|
|
|
$data['body'] = trim($this->body_remove_tag($data['body'],'Content-ID:'));
|
|
|
|
|
|
$data['body'] = $this->body_remove_tag($data['body'],"Content-");
|
|
|
$data['body'] = $this->body_remove_tag($data['body'],"Content-");
|
|
|
$data['body'] = $this->body_remove_tag($data['body'],"Content-");
|
|
|
$data['body'] = $this->body_remove_tag($data['body'],"Content-");
|
|
|
|
|
|
// 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){
|
|
|
|
|
|
// 这里还有可能出现附件
|
|
|
if($filename&&!empty($isfileattachment)){
|
|
|
$data = $this->parseFile($data,$filename);
|
|
|
}else{
|
|
|
// tag
|
|
|
$data['body'] = trim($this->body_remove_tag($data['body'],'Content-ID:'));
|
|
|
|
|
|
$data['body'] = $this->body_remove_tag($data['body'],"Content-");
|
|
|
$data['body'] = $this->body_remove_tag($data['body'],"Content-");
|
|
|
$data['body'] = $this->body_remove_tag($data['body'],"Content-");
|
|
|
$data['body'] = $this->body_remove_tag($data['body'],"Content-");
|
|
|
|
|
|
// 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;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 转码
|
|
|
// 转码
|
|
|
// if(isset($data['charset']) && $data['charset']){
|
|
|
// $debody = @mb_convert_encoding($data['body'],'utf-8',$data['charset']);
|
|
|
// if($debody){
|
...
|
...
|
@@ -310,6 +319,8 @@ class Body { |
|
|
// $debody = null;
|
|
|
// }
|
|
|
// }
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
...
|
...
|
|