本文整理汇总了PHP中Illuminate\Mail\Message::setBody方法的典型用法代码示例。如果您正苦于以下问题:PHP Message::setBody方法的具体用法?PHP Message::setBody怎么用?PHP Message::setBody使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Mail\Message
的用法示例。
在下文中一共展示了Message::setBody方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addContentRaw
/**
* Add the raw content to a given message.
*
* @param \Illuminate\Mail\Message $message
* @param string $html
* @param string $text
* @return void
*/
protected function addContentRaw($message, $html, $text)
{
if (isset($html)) {
$message->setBody($html, 'text/html');
}
if (isset($text)) {
$message->addPart($text, 'text/plain');
}
}
示例2: getIlluminateEmails
/**
* Builds the email array and return it as an array of all emails to be sent!!
*/
public function getIlluminateEmails()
{
$emails = [];
foreach ($this->tos as $destination) {
$mail = new Message(new Swift_Message());
$mail->to($destination[0], $destination[1]);
$mail->from($this->from['email'], $this->from['name']);
$mail->subject($this->subject);
$mail->setBody($this->body['content'], $this->body['type']);
foreach ($this->files as $file) {
$mail->attach($file);
}
$emails[] = $mail;
}
return $emails;
}
示例3: addContent
/**
* Add the content to a given message.
*
* @param \Illuminate\Mail\Message $message
* @param string $view
* @param string $plain
* @param array $data
* @return void
*/
protected function addContent($message, $view, $plain, $data)
{
if (isset($view)) {
$viewContent = $this->getView($view, $data);
$result = MailParser::parse($viewContent);
$message->setBody($result['html'], 'text/html');
if ($result['text']) {
$message->addPart($result['text'], 'text/plain');
}
if ($subject = array_get($result['settings'], 'subject')) {
$message->subject($subject);
}
}
if (isset($plain)) {
$message->addPart($this->getView($plain, $data), 'text/plain');
}
}
示例4: addContent
/**
* Add the content to a given message.
*
* @param \Illuminate\Mail\Message $message
* @param string $view
* @param string $plain
* @param array $data
* @return void
*/
protected function addContent($message, $view, $plain, $data)
{
if (isset($view)) {
$message->setBody($this->getView($view, $data), 'text/html');
}
if (isset($plain)) {
$message->addPart($this->getView($plain, $data), 'text/plain');
}
}
示例5: addContent
/**
* Add the content to a given message.
*
* @param \Illuminate\Mail\Message $message
* @param string $view
* @param string $plain
* @param string $raw
* @param array $data
* @return void
*/
protected function addContent($message, $view, $plain, $raw, $data)
{
if (isset($view)) {
$message->setBody($this->getView($view, $data), 'text/html');
}
if (isset($plain)) {
$method = isset($view) ? 'addPart' : 'setBody';
$message->{$method}($this->getView($plain, $data), 'text/plain');
}
if (isset($raw)) {
$method = isset($view) || isset($plain) ? 'addPart' : 'setBody';
$message->{$method}($raw, 'text/plain');
}
}
示例6: addContent
/**
* Add the content to a given message.
*
* @param \Illuminate\Mail\Message $message
* @param string $view
* @param string $plain
* @param array $data
* @return void
*/
protected function addContent($message, $view, $plain, $raw, $data)
{
/*
* Extensbility
*/
if ($this->fireEvent('mailer.beforeAddContent', [$message, $view, $data], true) === false || Event::fire('mailer.beforeAddContent', [$this, $message, $view, $data], true) === false) {
return;
}
if (isset($view)) {
$viewContent = $this->getView($view, $data);
$result = MailParser::parse($viewContent);
$message->setBody($result['html'], 'text/html');
if ($result['text']) {
$message->addPart($result['text'], 'text/plain');
}
if ($subject = array_get($result['settings'], 'subject')) {
$message->subject($subject);
}
}
if (isset($plain)) {
$message->addPart($this->getView($plain, $data), 'text/plain');
}
if (isset($raw)) {
$message->addPart($raw, 'text/plain');
}
/*
* Extensbility
*/
$this->fireEvent('mailer.addContent', [$message, $view, $data]);
Event::fire('mailer.addContent', [$this, $message, $view, $data]);
}