当前位置: 首页>>代码示例>>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;未经允许,请勿转载。