title: pdf file corrupted when try to forward mail from thunderbird/outlook
body: <ul>
  <li>Generated pdf with tcpdf</li>
  <li>It gives proper output, when open it directly to browser</li>
  <li>when try to send mail instead of download to local machine, in first occurance it open properly</li>
  <li>Forward mail from thunderbird to other user, that pdf file is corrupted and 
  showing message like : 
  "Adobe reader could not open 'nsmail-3.pdf' because it is either not a supported file type or 
  because the file has been damaged (for example, it was sent as an email attachment and wasn't correctly decoded)."</li>
  </ul>
  
  <p>Sample code to send mail is </p>
  
  <pre><code>$fileName = 'output.pdf';
  $fileatt = $pdfObj-&gt;Output('output.pdf', 'E'); 
  $attachment = chunk_split($fileatt);
  
  $eol = PHP_EOL;
  $separator = md5(time());
  $headers = 'From: Sender &lt;test@testmail.com&gt;'.$eol;
  $headers .= 'MIME-Version: 1.0'.$eol;
  $headers .= 'Content-Type: multipart/mixed; boundary="'.$separator.'"';
  
  $mailMessage .= '--'.$separator.$eol;
  $mailMessage .= 'Content-Type:text/html;Charset=ISO-8859-1'.$eol;
  $mailMessage .= 'Content-Transfer-Encoding: 8bit'.$eol.$eol;
  $mailMessage .= 'message content text'.$eol;
  
  $eol = "\r\n";
  $mailMessage .= '--'.$separator.$eol;
  $mailMessage .= 'Content-Type: application/pdf; name="'.$fileName.'"'.$eol;
  $mailMessage .= 'Content-Transfer-Encoding: base64'.$eol;
  $mailMessage .= 'Content-Disposition: attachment; filename='.$fileName.$eol;
  $mailMessage .= $attachment.$eol;
  $mailMessage .= '--'.$separator.'--';
  mail('test@testmail.com', $toEmailid, $subject, $mailMessage, $headers);
  </code></pre>
  
  <p><strong>can anyone suggest where I am wrong in above code ?</strong>
  <strong>or its thunderbird or outlook related issue ?</strong></p>