title: Mail Sending in TCPDF
body: <p>I have created a PDF using tcpdf function, then i wants to send it to a mail as attachment. i have used following coding at end of the creation of PDF. But it working in some server, but not working in some other servers</p>
  
  <pre><code>$from = "manikandan@niral.us";
          $subject = "test";
          $message = $_REQUEST['msg'];
  
  
          // a random hash will be necessary to send mixed content
          $separator = md5(time());
  
          // carriage return type (we use a PHP end of line constant)
          $eol = PHP_EOL;
           // $eol = "\r\n";
          // attachment name
          $filename = "Yourinvices.pdf";
  
          // encode data (puts attachment in proper format)
          $pdfdoc = $pdf-&gt;Output('Patient'.$invnumserial.'.pdf', 'S');
          $attachment = chunk_split(base64_encode($pdfdoc)); 
  
          // encode data (multipart mandatory)
          $headers = "From: ".$from.$eol;
          $headers .= "MIME-Version: 1.0".$eol;
          $headers .= "Content-Type: multipart/mixed; boundary=\"".$separator."\"".$eol.$eol;
          $headers .= "Content-Transfer-Enconding: 7bit".$eol;
          $headers .= "This is a MIME encoded message.".$eol.$eol;
  
          // message
          $headers .= "--".$separator.$eol;
          $headers .= "Content-Type: text/html; charsrt=\"iso-8859-1\"".$eol;
          $headers .= $message.$eol.$eol;
  
          // attachment
          $headers .= "--".$separator.$eol;
          $headers .= "Content-Type: application/octet-stream; name=\"".$filename."\"".$eol;
          //$headers .= "Content-Type: application/zip; name=\"".$filename."\"".$eol;
          $headers .= "Content-Transfer-Encoding: base64".$eol;
          $headers .= "Content-Disposition: attachment".$eol.$eol;
          $headers .= $attachment.$eol.$eol;
          $headers .= "--".$separator."--";
  
          // send message
         if(@mail($to, $subject, $message, $headers))
         {
  
           Redirect("../../patient_invoicelist.php?msg=1");   
        }
  
         else Redirect("../../patient_invoicelist.php?msg=2");   
  </code></pre>