mirror of https://gitee.com/karson/fastadmin.git
!286 解决自带Email类发送邮件收件人账号名是数组索引,移除未使用形参
Merge pull request !286 from Henry/email_bug_revisionpull/286/MERGE
commit
6bac3fca8a
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue