本文整理汇总了PHP中Zend\Mail\Message::from方法的典型用法代码示例。如果您正苦于以下问题:PHP Message::from方法的具体用法?PHP Message::from怎么用?PHP Message::from使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Mail\Message
的用法示例。
在下文中一共展示了Message::from方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareFromAddress
/**
* Retrieve email address for envelope FROM
*
* @param Message $message
* @return string
*/
protected function prepareFromAddress(Message $message)
{
$sender = $message->getSender();
if ($sender instanceof AddressDescription) {
return $sender->getEmail();
}
$from = $message->from();
if (!count($from)) {
throw new Exception\RuntimeException(sprintf('%s transport expects either a Sender or at least one From address in the Message; none provided', __CLASS__));
}
$from->rewind();
$sender = $from->current();
return $sender->getEmail();
}
示例2: prepareParameters
/**
* Prepare additional_parameters argument
*
* Basically, overrides the MAIL FROM envelope with either the Sender or
* From address.
*
* @param Message $message
* @return string
*/
protected function prepareParameters(Message $message)
{
if ($this->isWindowsOs()) {
return null;
}
$parameters = (string) $this->parameters;
$sender = $message->getSender();
if ($sender instanceof AddressDescription) {
$parameters .= ' -r ' . $sender->getEmail();
return $parameters;
}
$from = $message->from();
if (count($from)) {
$from->rewind();
$sender = $from->current();
$parameters .= ' -r ' . $sender->getEmail();
return $parameters;
}
return $parameters;
}