|
@@ -97,10 +97,9 @@ class Email
|
|
|
/**
|
|
/**
|
|
|
* 设置收件人
|
|
* 设置收件人
|
|
|
* @param mixed $email 收件人,多个收件人以,进行分隔
|
|
* @param mixed $email 收件人,多个收件人以,进行分隔
|
|
|
- * @param string $name 收件人名称
|
|
|
|
|
* @return $this
|
|
* @return $this
|
|
|
*/
|
|
*/
|
|
|
- public function to($email, $name = '')
|
|
|
|
|
|
|
+ public function to($email)
|
|
|
{
|
|
{
|
|
|
$emailArr = $this->buildAddress($email);
|
|
$emailArr = $this->buildAddress($email);
|
|
|
foreach ($emailArr as $address => $name) {
|
|
foreach ($emailArr as $address => $name) {
|
|
@@ -177,7 +176,12 @@ class Email
|
|
|
*/
|
|
*/
|
|
|
protected function buildAddress($emails)
|
|
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;
|
|
return $emails;
|
|
|
}
|
|
}
|
|
|
|
|
|