作者 邓超

body

@@ -194,7 +194,7 @@ class Body { @@ -194,7 +194,7 @@ class Body {
194 foreach ($this->item as $k=>$item){ 194 foreach ($this->item as $k=>$item){
195 if(isset($item['type'])){ 195 if(isset($item['type'])){
196 //是否有 =E2=81=B6=E2=81=B6=E2=81=B9=C2=B3=C2=B9=C2=B2=C2=BA=C2=B3=C2=BAS 一样的字符 196 //是否有 =E2=81=B6=E2=81=B6=E2=81=B9=C2=B3=C2=B9=C2=B2=C2=BA=C2=B3=C2=BAS 一样的字符
197 - if($item['type']=='text/plain' && preg_match("/(=[A-Z0-9]{2,}){2,}/",$item['body'])){ 197 + if(!empty($item['body']) && $item['type']=='text/plain' && preg_match("/(=[A-Z0-9]{2,}){2,}/",$item['body'])){
198 // 进行解码 198 // 进行解码
199 $item['body'] = quoted_printable_decode($item['body']); 199 $item['body'] = quoted_printable_decode($item['body']);
200 } 200 }
@@ -314,8 +314,9 @@ class Body { @@ -314,8 +314,9 @@ class Body {
314 $filename = mb_decode_mimeheader($filename[1]); 314 $filename = mb_decode_mimeheader($filename[1]);
315 } 315 }
316 // 附件 316 // 附件
317 - if(stripos($item,'Content-Disposition: attachment;')!==false){ 317 + if($data['type']=='text/plain' && stripos($item,'Content-Disposition: attachment;')!==false){
318 $isfileattachment = 1; 318 $isfileattachment = 1;
  319 + $data['append_html'] = 1;
319 } 320 }
320 321
321 322
@@ -335,6 +336,10 @@ class Body { @@ -335,6 +336,10 @@ class Body {
335 // 是文本还是附件 336 // 是文本还是附件
336 else if(strpos($data['type'],'text/') === 0 ){ 337 else if(strpos($data['type'],'text/') === 0 ){
337 338
  339 + if(($data['encode']??'')=='base64'){
  340 + $tempbody = explode("\r\n\r\n",trim($data['body']));
  341 + $tempbody = end($tempbody);
  342 + }else{
338 $tempbody = trim($this->body_remove_tag($data['body'],'Content-ID:')); 343 $tempbody = trim($this->body_remove_tag($data['body'],'Content-ID:'));
339 344
340 $tempbody = $this->body_remove_tag($tempbody,"Content-"); 345 $tempbody = $this->body_remove_tag($tempbody,"Content-");
@@ -342,9 +347,11 @@ class Body { @@ -342,9 +347,11 @@ class Body {
342 $tempbody = $this->body_remove_tag($tempbody,"Content-"); 347 $tempbody = $this->body_remove_tag($tempbody,"Content-");
343 $tempbody = $this->body_remove_tag($tempbody,"Content-"); 348 $tempbody = $this->body_remove_tag($tempbody,"Content-");
344 $tempbody = $this->body_remove_tag($tempbody,"X-OMN-MD5-Sum:"); 349 $tempbody = $this->body_remove_tag($tempbody,"X-OMN-MD5-Sum:");
  350 + $tempbody = $this->body_remove_tag($tempbody,"X-Attachment-Id:");
  351 + }
345 352
346 // 这里还有可能出现附件 353 // 这里还有可能出现附件
347 - if($filename&&!empty($isfileattachment)&&MailFun::isBase64($tempbody)&&$filename!='text_0.txt'){ 354 + if($filename&&empty($isfileattachment)){
348 $data = $this->parseFile($data,$filename); 355 $data = $this->parseFile($data,$filename);
349 }else{ 356 }else{
350 // tag 357 // tag