作者 邓超

x

... ... @@ -105,13 +105,13 @@ class Body {
if(!empty($this->header['Content-Type'])){
$ct = explode(";",$this->header['Content-Type']);
// 图片,以后有其他,需要添加
if(in_array($ct[0],['image/png','image/jpg','image/jpeg','image/gif'])){
if(in_array(trim($ct[0]),['image/png','image/jpg','image/jpeg','image/gif'])){
$isImage = 1;
}
}
if(!empty($isImage)){
$this->setItem(['type'=>'text/plain','body'=>"<img src=\"data:".($ct[0]??'image/png').";base64,".$body."\" />"]);
$this->setItem(['type'=>'text/html','body'=>"<img src=\"data:".($ct[0]??'image/png').";base64,".$body."\" />"]);
}else{
$this->setItem(['type'=>'text/plain','body'=>base64_decode($body)]);
}
... ...