当我在 Symfony2 应用程序中发送电子邮件时,我正在尝试命名发件人
Administrator <no-reply@app.com>
我已经尝试过parameters.ini
:
mailer_from = {"no-reply@app.com : Administrator"}
似乎可以这样做,因为在 SimpleMessage.php 中我们确实有:
/**
* Set the sender of this message.
* This does not override the From field, but it has a higher significance.
* @param string $sender
* @param string $name optional
* @return Swift_Mime_SimpleMessage
*/
public function setSender($address, $name = null)
{
if (!is_array($address) && isset($name))
{
$address = array($address => $name);
}
if (!$this->_setHeaderFieldModel('Sender', (array) $address))
{
$this->getHeaders()->addMailboxHeader('Sender', (array) $address);
}
return $this;
}
我尝试的所有事情都parameters.ini
失败了。你知道我做错了什么吗?