作者 邓超

1

@@ -328,12 +328,28 @@ class Mail { @@ -328,12 +328,28 @@ class Mail {
328 if(!empty($body)){ 328 if(!empty($body)){
329 $description = ''; 329 $description = '';
330 foreach ($body as $key=>$item){ 330 foreach ($body as $key=>$item){
331 - if(!$description && in_array($item['type'],['text/html','text/plain'])){  
332 - $description = mb_substr(trim(str_replace(["\n",' ',"\\n"," "],'',strip_tags($item['body']))),0,190); 331 + if(!$description && in_array($item['type']??'',['text/html','text/plain'])){
  332 +
  333 + $value = iconv($item['charset'],'utf-8',$item['body']);
  334 + $value=preg_replace("/<(script.*?)>(.*?)<(\/script.*?)>/si","",$value); //过滤script标签
  335 + $value=preg_replace("/<(\/?script.*?)>/si","",$value); //过滤script标签
  336 + $value=preg_replace("/javascript/si","Javascript",$value); //过滤script标签
  337 + $value = strip_tags($value);
  338 + $value = str_replace(["\n",' ',"\\n","&nbsp;"],'',$value);
  339 + $description = mb_substr(trim($value),0,190);
333 } 340 }
334 if(!empty($body[$key]['body'])){ 341 if(!empty($body[$key]['body'])){
335 $body[$key]['body'] = base64_encode($body[$key]['body']); 342 $body[$key]['body'] = base64_encode($body[$key]['body']);
336 } 343 }
  344 +
  345 + if(!empty($body[$key]['filename'])){
  346 + $body[$key]['filename'] = base64_encode($body[$key]['filename']);
  347 + }
  348 +
  349 + if(!empty($body[$key]['name'])){
  350 + $body[$key]['name'] = base64_encode($body[$key]['name']);
  351 + }
  352 +
337 } 353 }
338 354
339 try { 355 try {