| 
...
 | 
...
 | 
@@ -133,11 +133,7 @@ class Header{ | 
| 
 | 
 | 
      */
 | 
| 
 | 
 | 
     public function getTo(bool $isArray = false):array {
 | 
| 
 | 
 | 
         // 如果有这个字段,就用这个字段  to字段的邮箱可能被伪造
 | 
| 
 | 
 | 
         if(!empty($this->attributes['delivered-to'])){
 | 
| 
 | 
 | 
             $to = $this->attributes['delivered-to'];
 | 
| 
 | 
 | 
         }else{
 | 
| 
 | 
 | 
             $to = $this->attributes['to']??'';
 | 
| 
 | 
 | 
         }
 | 
| 
 | 
 | 
         $to = $this->attributes['to']??$this->attributes['delivered-to'];
 | 
| 
 | 
 | 
 
 | 
| 
 | 
 | 
         return $this->parseAddress($to,$isArray);
 | 
| 
 | 
 | 
     }
 | 
| 
...
 | 
...
 | 
@@ -152,14 +148,25 @@ class Header{ | 
| 
 | 
 | 
      */
 | 
| 
 | 
 | 
     private function parseAddress(string $address, $isArray = false){
 | 
| 
 | 
 | 
         $arr = [];
 | 
| 
 | 
 | 
         $address = trim($address);
 | 
| 
 | 
 | 
         if($address){
 | 
| 
 | 
 | 
             foreach (explode(',',$address) as $k=>$str){
 | 
| 
 | 
 | 
             $address = explode(',',$address);
 | 
| 
 | 
 | 
             $s = '';
 | 
| 
 | 
 | 
             foreach ($address as $k=>$str){
 | 
| 
 | 
 | 
                 // 是否是邮箱
 | 
| 
 | 
 | 
                 if (!(str_contains($str, '@') && str_contains($str,'.'))){
 | 
| 
 | 
 | 
                     $s .= $str.',';
 | 
| 
 | 
 | 
                     continue;
 | 
| 
 | 
 | 
                 }
 | 
| 
 | 
 | 
                 $str = $s.$str;
 | 
| 
 | 
 | 
                 $s = '';
 | 
| 
 | 
 | 
 
 | 
| 
 | 
 | 
                 $arr[$k] = Address::make($str);
 | 
| 
 | 
 | 
                 if($isArray) $arr[$k] =  $arr[$k]->toArray();
 | 
| 
 | 
 | 
             }
 | 
| 
 | 
 | 
         }
 | 
| 
 | 
 | 
 
 | 
| 
 | 
 | 
         return $arr;
 | 
| 
 | 
 | 
         return array_values($arr);
 | 
| 
 | 
 | 
     }
 | 
| 
 | 
 | 
 
 | 
| 
 | 
 | 
     /**
 | 
...
 | 
...
 | 
 |