作者 邓超

1

... ... @@ -328,12 +328,28 @@ class Mail {
if(!empty($body)){
$description = '';
foreach ($body as $key=>$item){
if(!$description && in_array($item['type'],['text/html','text/plain'])){
$description = mb_substr(trim(str_replace(["\n",' ',"\\n"," "],'',strip_tags($item['body']))),0,190);
if(!$description && in_array($item['type']??'',['text/html','text/plain'])){
$value = iconv($item['charset'],'utf-8',$item['body']);
$value=preg_replace("/<(script.*?)>(.*?)<(\/script.*?)>/si","",$value); //过滤script标签
$value=preg_replace("/<(\/?script.*?)>/si","",$value); //过滤script标签
$value=preg_replace("/javascript/si","Javascript",$value); //过滤script标签
$value = strip_tags($value);
$value = str_replace(["\n",' ',"\\n","&nbsp;"],'',$value);
$description = mb_substr(trim($value),0,190);
}
if(!empty($body[$key]['body'])){
$body[$key]['body'] = base64_encode($body[$key]['body']);
}
if(!empty($body[$key]['filename'])){
$body[$key]['filename'] = base64_encode($body[$key]['filename']);
}
if(!empty($body[$key]['name'])){
$body[$key]['name'] = base64_encode($body[$key]['name']);
}
}
try {
... ...