예제 #1
0
 /**
  * Set the attachement.
  *
  * @param string $path
  */
 public function attach($file)
 {
     if (File::exists($file)) {
         $filename = explode('/', $file)[count(explode('/', $file)) - 1];
         $mime = mime_content_type($file);
         $attachment = new \Sendgrid\Attachment();
         $attachment->setContent(File::get($file));
         $attachment->setType($mime);
         $attachment->setFilename($filename);
         $attachment->setDisposition('attachment');
         $attachment->setContentId($filename);
         $this->mail->addAttachment($attachment);
     }
     return $this;
 }
예제 #2
0
파일: FileTest.php 프로젝트: anekdotes/file
 public function testCheckIfCantOpenFile()
 {
     $file = File::get(__DIR__ . '/dummy/doesntexist.jpg');
     $this->assertEmpty($file, 'Could open file');
 }