Browse Source

解决使用自带Email类发送邮件时,收件人账号名是数组索引的问题

Henry 4 years ago
parent
commit
5ab531e0ec
1 changed files with 6 additions and 1 deletions
  1. 6 1
      application/common/library/Email.php

+ 6 - 1
application/common/library/Email.php

@@ -176,7 +176,12 @@ class Email
      */
     protected function buildAddress($emails)
     {
-        $emails = is_array($emails) ? $emails : array_flip(explode(',', str_replace(";", ",", $emails)));
+        if (!is_array($emails)) {
+            $emails = array_flip(explode(',', str_replace(";", ",", $emails)));
+            foreach ($emails as $key => $value) {
+                $emails[$key] = strstr($key, '@', true);
+            }
+        }
         return $emails;
     }