那是一个BUG。
我只是面临同样的问题,无论我如何传递参数,它都无法指定名称。
在 Joomla!源代码 /libraries/joomla/mail/mail.php,从第 167 行开始,文档注释说:
/**
* Add recipients to the email
*
* @param mixed $recipient Either a string or array of strings [email address(es)]
* @param mixed $name Either a string or array of strings [name(s)]
*
* @return JMail Returns this object for chaining.
*
* @since 11.1
*/
很好,但变量 $name永远不要在函数中使用:
public function addRecipient($recipient, $name = '')
{
// If the recipient is an array, add each recipient... otherwise just add the one
if (is_array($recipient))
{
foreach ($recipient as $to)
{
$to = JMailHelper::cleanLine($to);
$this->AddAddress($to);
}
}
else
{
$recipient = JMailHelper::cleanLine($recipient);
$this->AddAddress($recipient);
}
return $this;
}