作者 邓超

x

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