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


PHP Message::attach方法代碼示例

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


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

示例1: testGetAttachments

 public function testGetAttachments()
 {
     $getAttachment = \Closure::bind(function ($message) {
         return $this->getAttachments($message);
     }, $this->transport, SendgridV3Transport::class);
     $message = new Message($this->getMessage());
     $file = __DIR__ . '/test.png';
     $message->attach($file);
     $res = $getAttachment($message->getSwiftMessage());
     $this->assertEquals(base64_encode(file_get_contents($file)), array_get($res, '0.content'));
     $this->assertEquals('test.png', array_get($res, '0.filename'));
 }
開發者ID:s-ichikawa,項目名稱:laravel-sendgrid-driver,代碼行數:12,代碼來源:SendgridV3TransportTest.php

示例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;
 }
開發者ID:anekdotes,項目名稱:mailer,代碼行數:19,代碼來源:MailTrapEmailAdapter.php

示例3: sendClosure

 protected function sendClosure(Message $mailObject)
 {
     $mailObject->subject($this->subject);
     $mailObject->from($this->from[0]['address'], $this->from[0]['name']);
     foreach ($this->to as $toDetails) {
         $mailObject->to($toDetails['address'], $toDetails['name']);
     }
     foreach ($this->cc as $ccDetails) {
         $mailObject->cc($ccDetails['address'], $ccDetails['name']);
     }
     foreach ($this->bcc as $bccDetails) {
         $mailObject->bcc($bccDetails['address'], $bccDetails['name']);
     }
     foreach ($this->attachments as $attachmentDetails) {
         $mailObject->attach($attachmentDetails['file'], ['as' => $attachmentDetails['filename'], 'mime' => $attachmentDetails['mimetype']]);
     }
 }
開發者ID:vultuk,項目名稱:MailAwesome,代碼行數:17,代碼來源:MailAwesome.php

示例4: 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

示例5: 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

示例6: testSetAttachment

 public function testSetAttachment()
 {
     $setAttachment = \Closure::bind(function (&$data, $message) {
         return $this->setAttachment($data, $message);
     }, $this->transport, 'Sichikawa\\LaravelSendgridDriver\\Transport\\SendGridTransport');
     $data = [];
     $message = new Message($this->getMessage());
     $message->attach(__DIR__ . '/test.png');
     $setAttachment($data, $message->getSwiftMessage());
     $this->assertEquals('stream', get_resource_type($data['files[test.png]']));
 }
開發者ID:alexdeoliveira,項目名稱:laravel-sendgrid-driver,代碼行數:11,代碼來源:SendgridTransportTest.php


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