作者 邓超

body

... ... @@ -194,7 +194,7 @@ class Body {
foreach ($this->item as $k=>$item){
if(isset($item['type'])){
//是否有 =E2=81=B6=E2=81=B6=E2=81=B9=C2=B3=C2=B9=C2=B2=C2=BA=C2=B3=C2=BAS 一样的字符
if($item['type']=='text/plain' && preg_match("/(=[A-Z0-9]{2,}){2,}/",$item['body'])){
if(!empty($item['body']) && $item['type']=='text/plain' && preg_match("/(=[A-Z0-9]{2,}){2,}/",$item['body'])){
// 进行解码
$item['body'] = quoted_printable_decode($item['body']);
}
... ... @@ -314,8 +314,9 @@ class Body {
$filename = mb_decode_mimeheader($filename[1]);
}
// 附件
if(stripos($item,'Content-Disposition: attachment;')!==false){
if($data['type']=='text/plain' && stripos($item,'Content-Disposition: attachment;')!==false){
$isfileattachment = 1;
$data['append_html'] = 1;
}
... ... @@ -335,6 +336,10 @@ class Body {
// 是文本还是附件
else if(strpos($data['type'],'text/') === 0 ){
if(($data['encode']??'')=='base64'){
$tempbody = explode("\r\n\r\n",trim($data['body']));
$tempbody = end($tempbody);
}else{
$tempbody = trim($this->body_remove_tag($data['body'],'Content-ID:'));
$tempbody = $this->body_remove_tag($tempbody,"Content-");
... ... @@ -342,9 +347,11 @@ class Body {
$tempbody = $this->body_remove_tag($tempbody,"Content-");
$tempbody = $this->body_remove_tag($tempbody,"Content-");
$tempbody = $this->body_remove_tag($tempbody,"X-OMN-MD5-Sum:");
$tempbody = $this->body_remove_tag($tempbody,"X-Attachment-Id:");
}
// 这里还有可能出现附件
if($filename&&!empty($isfileattachment)&&MailFun::isBase64($tempbody)&&$filename!='text_0.txt'){
if($filename&&empty($isfileattachment)){
$data = $this->parseFile($data,$filename);
}else{
// tag
... ...