title: Sending dynamic email attachement from view in codeigniter
body: <p>I want to attach a file to an email. but the file fetches from a dynamic view. Is it possible?</p>
  <p>Here is the code I have made in phpmailer.</p>
  <pre><code>  $url = 'http://somewebsite.com/parameter';
    $binary_content = file_get_contents($url);
    if ($binary_content === false) {
      throw new Exception(&quot;Could not fetch remote content from: '$url'&quot;);
    }
    $mail-&gt;AddStringAttachment($binary_content, &quot;test.pdf&quot;, $encoding = 'base64', $type = 'application/pdf');
  </code></pre>
  <p>The code above successfully attached in the email. But the pdf file cannot be opened or an error.</p>