title: How to attach a PDF using barryvdh/laravel-dompdf into an email in Laravel
body: <p>I know this question has been asked before but I apparently need my hand held.  I'm trying to attach the pdf to an email and send it off.  I've done it outside of Laravel with PHPMailer, but now I'm trying to it the Laravel way and cant get it to work.  What am I doing wrong here?</p>
  
  <p>Here is the start of the error I'm getting :</p>
  
  <p>Swift_IoException in FileByteStream.php line 144:
  Unable to open file for reading [%PDF-1.3</p>
  
  <pre><code>    public function attach_email($id){
  
      $info = Load::find($id);
  
      $info = ['info'=&gt;$info];
  
      Mail::send(['text'=&gt;'mail'], $info, function($message){
  
          $pdf = PDF::loadView('pdf.invoice');
  
          $message-&gt;to('example@gmail.com','John Smith')-&gt;subject('Send Mail from Laravel');
  
          $message-&gt;from('from@gmail.com','The Sender');
  
          $message-&gt;attach($pdf-&gt;output());
  
      });
     echo 'Email was sent!';
    }
  </code></pre>