title: Send attachment and message using table by mail in php
body: <p>I want to attach a generated pdf file and a  Thank you message with a contents generated in the pdf in the body of mail done by using html table.
  Attaching and mailing the file works fine. But the thank you message and details doesn't appear in the body of mail. Here is code.</p>
  
  <pre><code>$pdf-&gt;Output('abc-REG.pdf', 'I');
  $to = 'abc@gmail.com, ' . $email;
  $subject = 'ABC :: ACTIVATION';
  $repEmail = 'abc@gmail.com';
  $fileName = 'abc-REG.pdf';
  $fileatt = $pdf-&gt;Output($fileName, 'E');
  $attachment = chunk_split($fileatt);
  $eol = PHP_EOL;
  $separator = md5(time());
  $headers = 'From: ABC &lt;'.$repEmail.'&gt;'.$eol;
  $headers .= 'MIME-Version: 1.0' .$eol;
  $headers .= "Content-Type: multipart/mixed; boundary=\"".$separator."\"";
  $message = "--".$separator.$eol;
  $message .= "Content-Transfer-Encoding: 7bit".$eol.$eol;
  $message .= '&lt;html&gt;&lt;body&gt;';
  $message .= '&lt;img src="http://google.com/images/logo.png"  /&gt;&lt;br/&gt;';
  $message .= "Thanks for Activation. Your online registration number is A0". mysql_insert_id() ". "
      $message .= '&lt;table rules="all" style="border-color: #666;" cellpadding="10"&gt;';
  $message .= "&lt;tr style='background: #eee;'&gt;&lt;td&gt;&lt;strong&gt;Name:&lt;/strong&gt; &lt;/td&gt;&lt;td&gt;" . strip_tags($_POST['name']) . "&lt;/td&gt;&lt;/tr&gt;";
  $message .= "&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Email:&lt;/strong&gt; &lt;/td&gt;&lt;td&gt;" . strip_tags($_POST['email']) . "&lt;/td&gt;&lt;/tr&gt;";
  $message .= "&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Mobile:&lt;/strong&gt; &lt;/td&gt;&lt;td&gt;" . strip_tags($_POST['mobile']) . "&lt;/td&gt;&lt;/tr&gt;";
  $message .= "&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Organisation Name:&lt;/strong&gt; &lt;/td&gt;&lt;td&gt;" . strip_tags($_POST['cname']) . "&lt;/td&gt;&lt;/tr&gt;";
  $message .= "&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Address:&lt;/strong&gt; &lt;/td&gt;&lt;td&gt;" .  strip_tags($_POST['Address']) . "&lt;/td&gt;&lt;/tr&gt;"; 
  $message .= "&lt;/table&gt;";
  $message .= "&lt;/body&gt;&lt;/html&gt;".$eol;
  $message .= "--".$separator.$eol;
  $message .= "Content-Type: text/html; charset=\"iso-8859-1\"".$eol;
  $message .= "Content-Transfer-Encoding: 8bit".$eol.$eol;
  $message .= "--".$separator.$eol;
  $message .= "Content-Type: application/pdf; name=\"".$fileName."\"".$eol; 
  $message .= "Content-Transfer-Encoding: base64".$eol;
  $message .= "Content-Disposition: attachment".$eol.$eol;
  $message .= $attachment.$eol;
  $message .= "--".$separator."--";
  if (mail($to, $subject, $message, $headers)){
      echo "Email sent";
  }
  else {
      echo "Email failed";
  }
  </code></pre>