diff --git a/application/common/library/Email.php b/application/common/library/Email.php index 7d934eca..7636d761 100644 --- a/application/common/library/Email.php +++ b/application/common/library/Email.php @@ -97,10 +97,9 @@ class Email /** * 设置收件人 * @param mixed $email 收件人,多个收件人以,进行分隔 - * @param string $name 收件人名称 * @return $this */ - public function to($email, $name = '') + public function to($email) { $emailArr = $this->buildAddress($email); foreach ($emailArr as $address => $name) { @@ -177,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; }