...
|
...
|
@@ -3,6 +3,8 @@ |
|
|
namespace Lib\Imap\Parse;
|
|
|
|
|
|
|
|
|
use Lib\Imap\Fun;
|
|
|
|
|
|
/**
|
|
|
* 解析邮件
|
|
|
* @author:dc
|
...
|
...
|
@@ -74,7 +76,23 @@ class Header{ |
|
|
|
|
|
}
|
|
|
|
|
|
// 头信息content-type
|
|
|
$contentType = $this->get('content-type');
|
|
|
if($contentType){
|
|
|
preg_match("/charset=\"?([a-z0-9-._]{2,})\"?/",$contentType,$charset);
|
|
|
if(!empty($charset[1])){
|
|
|
// 编码
|
|
|
$this->setAttribute('charset',$charset[1]);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 编码
|
|
|
$charset = $this->get('charset');
|
|
|
|
|
|
foreach ($this->attributes as $name => $attribute){
|
|
|
if($charset){
|
|
|
$attribute = Fun::mb_convert_encoding($attribute,'UTF-8',$charset);
|
|
|
}
|
|
|
$attribute = trim($attribute);
|
|
|
$this->attributes[$name] = $attribute;
|
|
|
}
|
...
|
...
|
|