title: Receiving "ATT00001.txt" instead of pdf with the mail function
body: <p>I tried to send a mail with an attachement with the mail function, I found a tutorial for a JPG and tried to modify it for sending PDF, but the only attachement I receive is <code>ATT00001.txt</code>.</p>
  
  <p>Here is my programm:</p>
  
  <pre><code>&lt;?php
  // To
  $to = 'mail@test.com';
  
  // Subject
  $subject = 'Test pdf';
  
  // random boundary
  $boundary = md5(uniqid(microtime(), TRUE));
  
  // Headers
  $headers = 'From: Test &lt;mail@test.com&gt;'."\r\n";
  $headers .= 'Mime-Version: 1.0'."\r\n";
  $headers .= 'Content-Type: multipart/mixed;boundary='.$boundary."\r\n";
  $headers .= "\r\n";
  
  // Message
  $msg = 'This is a multipart/mixed message.'."\r\n\r\n";
  
  // Text
  $msg .= '--'.$boundary."\r\n";
  $msg .= 'Content-type:text/plain;charset=utf-8'."\r\n";
  $msg .= 'Content-transfer-encoding:8bit'."\r\n";
  $msg .= 'Un message avec une pièce jointe.'."\r\n";
  
  // Attachement
  $file_name = 'test.pdf';
  if (file_exists($file_name))
  {
      $file_type = filetype($file_name);
      $file_size = filesize($file_name);
  
      $handle = fopen($file_name, 'r') or die('File '.$file_name.'can t be open');
      $content = fread($handle, $file_size);
      $content = chunk_split(base64_encode($content));
      $f = fclose($handle);
  
      $msg .= '--'.$boundary."\r\n";
      $msg .= 'Content-type:'.$file_type.';name='.$file_name."\r\n";
      $msg .= 'Content-transfer-encoding:base64'."\r\n";
      $msg .= $content."\r\n";
  }
  
  // End
  $msg .= '--'.$boundary."\r\n";
  
  // Function mail()
  mail($to, $subject, $msg, $headers);
  echo "test pdf";
  ?&gt;
  </code></pre>
  
  <p>I hope you could help me,</p>
  
  <p>Best regards ☻♥</p>