title: PHP Mail file sending but no message body is including
body: <p>I am sending a file to an email address.  The file is sent correctly but the message is not attaching with it. (e.g. Kindly find the attached file).</p>
  
  <p>When I send the email, the file is attached correctly, but there is no message body in it.</p>
  
  <pre><code>$name        = $name;
  $email       = $email;
  $to          = "$name &lt;$email&gt;";
  $from        = "Travel Mate ";
  $subject     = "42 Days Across Border Requirements";
  $mainMessage = "Kindly Find the Attached File";
  $fileatt     = "42dc-form.pdf";
  $fileatttype = "application/pdf";
  $fileattname = "42DaysAcrossBorders.pdf";
  $headers     = 'From: info@travelmate.com.pk' . "\r\n" .
                 'Reply-To: info@travelmate.com.pk' . "\r\n" .
                 'X-Mailer: PHP/' . phpversion();
  // File
  $file = fopen($fileatt, 'rb');
  $data = fread($file, filesize($fileatt));
  fclose($file);
  
  // This attaches the file
  $semi_rand     = md5(time());
  $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
  $headers      .= "\nMIME-Version: 1.0\n" .
                   "Content-Type: multipart/mixed;\n" .
                   " boundary=\"{$mime_boundary}\"";
  $message       = "42 Days Across Borders Form.\n" .
                   "-{$mime_boundary}\n" .
                   "Content-Type: text/plain; charset=\"iso-8859-1\n" .
                   "Content-Transfer-Encoding: 7bit\n" . $mainMessage  . "\n";
  
  $data     = chunk_split(base64_encode($data));
  $message .= "--{$mime_boundary}\n" .
              "Content-Type: {$fileatttype};\n" .
              " name=\"{$fileattname}\"\n" .
              "Content-Disposition: attachment;\n" .
              "filename=\"{$fileattname}\"\n" .
              "Content-Transfer-Encoding: base64\n" .
              $data . "\n\n" .
              "-{$mime_boundary}-\n";
  //$message = "sdfsdfsdf ";
  
  if (mail($to,$subject, $mainMessage.$message, $headers)) {
      header('Location:index.php?s=success');
      $result='&lt;div class="alert alert-success col-sm-12"&gt;Thank You! I will be in touch&lt;/div&gt;';
  }
  </code></pre>