title: Send pdf in Email Without Saving it on Server Using Codeigniter
body: <p>I have been trying to send email with attachment of <code>pdf</code> produced by <code>MPDF</code> library in codeigniter from my view, I have successfully converted my file to <code>PDF</code> or i think i did, but i cannot find any way to attach that file to email using given functionality in CodeIgniter.</p>
  
  <p>In Documentation of CodeIgnitor a confusing and incomplete description of <code>attach</code> function is suggesting this:</p>
  
  <blockquote>
    <p>$this->email->attach($buffer, 'attachment', 'report.pdf',
    'application/pdf');</p>
  </blockquote>
  
  <p>Where <code>$buffer</code> is string <code>report.pdf</code> will be the fileName where of attachment with email,</p>
  
  <p>Now my concern here is can i attach my generated view something like this:</p>
  
  <pre><code>ini_set('memory_limit', '20M');
  // load library
  $this-&gt;load-&gt;library('pdf');
  $pdf = $this-&gt;pdf-&gt;load();
  
  // boost the memory limit if it's low ;)
  $html = $this-&gt;load-&gt;view('reports/someReport', array('var' =&gt; 123), true);
  // render the view into HTML
  $pdf-&gt;WriteHTML($html);
  $this-&gt;email-&gt;attach($pdf-&gt;Output('', 'S'), 'attachment', 'report.pdf', 'application/pdf'); // is this okay or something is wrong here ?
  </code></pre>
  
  <p>How can i attach it successfully with email and send it</p>