正在显示
1 个修改的文件
包含
14 行增加
和
1 行删除
@@ -330,14 +330,27 @@ class Mail { | @@ -330,14 +330,27 @@ class Mail { | ||
330 | foreach ($body as $key=>$item){ | 330 | foreach ($body as $key=>$item){ |
331 | if(!$description && in_array($item['type']??'',['text/html','text/plain'])){ | 331 | if(!$description && in_array($item['type']??'',['text/html','text/plain'])){ |
332 | 332 | ||
333 | - $value = iconv($item['charset'],'utf-8',$item['body']); | 333 | + // 是否是base64 |
334 | + $value = @base64_decode($item['body']); | ||
335 | + | ||
336 | + if(!$value){ | ||
337 | + $value = $item['body']; | ||
338 | + } | ||
339 | + | ||
340 | + if(!empty($item['charset'])){ | ||
341 | + $value = iconv($item['charset'],'utf-8',$value); | ||
342 | + } | ||
334 | $value=preg_replace("/<(script.*?)>(.*?)<(\/script.*?)>/si","",$value); //过滤script标签 | 343 | $value=preg_replace("/<(script.*?)>(.*?)<(\/script.*?)>/si","",$value); //过滤script标签 |
335 | $value=preg_replace("/<(\/?script.*?)>/si","",$value); //过滤script标签 | 344 | $value=preg_replace("/<(\/?script.*?)>/si","",$value); //过滤script标签 |
336 | $value=preg_replace("/javascript/si","Javascript",$value); //过滤script标签 | 345 | $value=preg_replace("/javascript/si","Javascript",$value); //过滤script标签 |
346 | + $value=preg_replace("/<(style.*?)>(.*?)<(\/style.*?)>/si","",$value); //过滤style标签 | ||
347 | + $value=preg_replace("/<(\/?style.*?)>/si","",$value); //过滤style标签 | ||
348 | + | ||
337 | $value = strip_tags($value); | 349 | $value = strip_tags($value); |
338 | $value = str_replace(["\n",' ',"\\n"," "],'',$value); | 350 | $value = str_replace(["\n",' ',"\\n"," "],'',$value); |
339 | $description = mb_substr(trim($value),0,190); | 351 | $description = mb_substr(trim($value),0,190); |
340 | } | 352 | } |
353 | + | ||
341 | if(!empty($body[$key]['body'])){ | 354 | if(!empty($body[$key]['body'])){ |
342 | $body[$key]['body'] = base64_encode($body[$key]['body']); | 355 | $body[$key]['body'] = base64_encode($body[$key]['body']); |
343 | } | 356 | } |
-
请 注册 或 登录 后发表评论