title: Attach pdf generated with TCPDF sending mail with mail PHP function
body: <p>I want send a pdf generated with TCPDF using mail Php function.</p>
  
  <p>If I send a simple mail like this works: mail('xxx@ne.es', 'My Subject', $message);</p>
  
  <p>The pdf is generated well, but when I want attach pdf in header not works.</p>
  
  <p>This is my code:</p>
  
  <pre><code>$pdfdoc=$pdf-&gt;Output('file.pdf', 'S');
  
   $separator = md5(time());
  
          $eol = PHP_EOL;
  // Send
          $filename = "_Desiredfilename.pdf";
  
          // encode data (puts attachment in proper format)
  
          $attachment = chunk_split(base64_encode($pdfdoc));
  
          ///////////HEADERS INFORMATION////////////
          // main header (multipart mandatory) message
          $headers  = "From: Sender_Name&lt;sender@domain.com&gt;".$eol;
          $headers .= "Bcc: email@domain.com".$eol;
          $headers .= "MIME-Version: 1.0".$eol;
          $headers .= "Content-Type: multipart/mixed; boundary=\"".$separator."\"".$eol.$eol;
          $headers .= "Content-Transfer-Encoding: 7bit".$eol;
          $headers .= "This is a MIME encoded message.".$eol.$eol;
  
          // message
          $headers .= "--".$separator.$eol;
          $headers .= "Content-Type: text/html; charset=\"iso-8859-1\"".$eol;
          $headers .= "Content-Transfer-Encoding: 8bit".$eol.$eol;
          $headers .= $message.$eol.$eol;
  
          // attachment
          $headers .= "--".$separator.$eol;
          $headers .= "Content-Type: application/octet-stream; name=\"".$filename."\"".$eol;
          $headers .= "Content-Transfer-Encoding: base64".$eol;
          $headers .= "Content-Disposition: attachment".$eol.$eol;
          $headers .= $attachment.$eol.$eol;
          $headers .= "--".$separator."--";
  
  
          //Email message
          mail('xxx@gmail.com', 'prova', 'hola', $headers);
  </code></pre>
  
  <p>When is the problem?</p>
  
  <p>Thanks</p>
  
  <p>Regards</p>