當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Message::attachData方法代碼示例

本文整理匯總了PHP中Illuminate\Mail\Message::attachData方法的典型用法代碼示例。如果您正苦於以下問題:PHP Message::attachData方法的具體用法?PHP Message::attachData怎麽用?PHP Message::attachData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Illuminate\Mail\Message的用法示例。


在下文中一共展示了Message::attachData方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: addAttachments

 /**
  * Add the attachments to the message.
  *
  * @param  \Illuminate\Mail\Message  $mailMessage
  * @param  \Illuminate\Notifications\Messages\MailMessage  $message
  * @return void
  */
 protected function addAttachments($mailMessage, $message)
 {
     foreach ($message->attachments as $attachment) {
         $mailMessage->attach($attachment['file'], $attachment['options']);
     }
     foreach ($message->rawAttachments as $attachment) {
         $mailMessage->attachData($attachment['data'], $attachment['name'], $attachment['options']);
     }
 }
開發者ID:jarnovanleeuwen,項目名稱:framework,代碼行數:16,代碼來源:MailChannel.php

示例2: buildAttachments

 /**
  * Add all of the attachments to the message.
  *
  * @param  \Illuminate\Mail\Message  $message
  * @return $this
  */
 protected function buildAttachments($message)
 {
     foreach ($this->attachments as $attachment) {
         $message->attach($attachment['file'], $attachment['options']);
     }
     foreach ($this->rawAttachments as $attachment) {
         $message->attachData($attachment['data'], $attachment['name'], $attachment['options']);
     }
     return $this;
 }
開發者ID:scrubmx,項目名稱:framework,代碼行數:16,代碼來源:Mailable.php

示例3: generateMessage

 /**
  * Generates a \Illuminate\Mail\Message template ready to send
  *
  * @param array $args = []
  * @return $this
  */
 public function generateMessage($args = [])
 {
     if (!empty($args)) {
         foreach ($args as $att => $v) {
             if (array_key_exists($att, get_object_vars($this))) {
                 $this->{$att} = $v;
             }
         }
     }
     $msg = new Message(new \Swift_Message());
     if ($this->hasFrom()) {
         $from = $this->getFrom();
         $msg->from($from[0], $from[1]);
     }
     if ($this->hasSender()) {
         $sender = $this->getSender();
         $msg->sender($sender[0], $sender[1]);
     }
     if ($this->hasTo()) {
         $to = $this->getTo();
         $msg->to($to[0], $to[1]);
     }
     if ($this->hasCc()) {
         $cc = $this->getCc();
         $msg->cc($cc[0], $cc[1]);
     }
     if ($this->hasBcc()) {
         $bcc = $this->getBcc();
         $msg->bcc($bcc[0], $bcc[1]);
     }
     if ($this->hasReplyTo()) {
         $reply_to = $this->getReplyTo();
         $msg->replyTo($reply_to[0], $reply_to[1]);
     }
     if ($this->hasSubject()) {
         $msg->subject($this->getSubject());
     }
     if ($this->hasAttach()) {
         foreach ($this->getAttach() as $attach) {
             $msg->attachData($attach[0], $attach[1], $attach[2]);
         }
     }
     if ($this->hasPriority()) {
         $msg->priority($this->getPriority());
     }
     $this->setMessage($msg);
     return $this;
 }
開發者ID:frenchfrogs,項目名稱:mail,代碼行數:54,代碼來源:Mail.php


注:本文中的Illuminate\Mail\Message::attachData方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。