title: Error: Message body Empty Using Php Mailer
body: <p>When a User submits a form I send an e-mail containing the form data.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>   $message = '
     &lt;html&gt;
     &lt;head&gt;
     &lt;title&gt;ES Html Report&lt;/title&gt;
     &lt;/head&gt;
     &lt;body&gt;
      &lt;table&gt;
      &lt;tr&gt;
        &lt;th&gt;Project Name&lt;/th&gt;
        &lt;th&gt;TODo&lt;/th&gt;
        &lt;th&gt;Priority&lt;/th&gt;
        &lt;th&gt;Due on&lt;/th&gt;
        &lt;th&gt;Assignee&lt;/th&gt;
        &lt;th&gt;Created&lt;/th&gt;
        &lt;th&gt;Updated&lt;/th&gt;
        &lt;th&gt;Completed&lt;/th&gt;
        &lt;th&gt;Assignee Status&lt;/th&gt;
       &lt;th&gt;Status&lt;/th&gt;
       &lt;/tr&gt;
  
       &lt;tr&gt;
          &lt;td&gt;'.$todolists_store_row['Projects_name'].'&lt;/td&gt;
          &lt;td&gt;'.$todolists_store_row['Name'].' &lt;/td&gt;
          &lt;td&gt;'.$todolists_store_row['priority'].'&lt;/td&gt;
          &lt;td&gt;'.$todolists_store_row['Due_on'].'&lt;/td&gt; 
          &lt;td&gt;'.$todolists_store_row['assignee_name'].'&lt;/td&gt; 
           &lt;td&gt;'.$todolists_store_row['Created_at'].'&lt;/td&gt; 
          &lt;td&gt;'.$todolists_store_row['Modified_at'].'&lt;/td&gt; 
          &lt;td&gt;'.$todolists_store_row['Completed_at'].'&lt;/td&gt; 
           &lt;td&gt;'.$todolists_store_row['Assignee_status'].'&lt;/td&gt; 
           &lt;td&gt;'.$status.'&lt;/td&gt; 
      &lt;/tr&gt;
    &lt;/table&gt;
  &lt;/body&gt;
    &lt;/html&gt;
      ';
  
      }
  
     $mail = new PHPMailer();
     $mail-&gt;isSendmail();
  
     $mail-&gt;setFrom('a5@gmail.com', 'First Last');
  
      $mail-&gt;addAddress($others, 'John Doe');
  
        $body= preg_replace('/\[\]/','',$message);
       $mail-&gt;IsHTML(true);
       $mail-&gt;Body =$body;
      var_dump($body);
  
     $mail-&gt;AltBody = 'This is a plain-text message body';
  
      //send the message, check for errors
      if (!$mail-&gt;send()) {
          echo "Mailer Error: " . $mail-&gt;ErrorInfo;
      } else {
          echo "Message sent!";
      }
  </code></pre>
  
  <ul>
  <li><p>I have tried debug code  $mail->msgHTML($body); //no html is sent</p></li>
  <li><p>I looked for help from url: <a href="https://stackoverflow.com/questions/13816571/phpmailer-mailer-error-message-body-empty">PHPMailer Mailer Error: Message body empty</a>. and <a href="https://stackoverflow.com/questions/11506691/php-mailer-class-issue-message-body-empty">PHP Mailer Class issue :Message body empty</a> but neither of them helped.</p></li>
  <li><p>I also tried to var_dump($body) and I got:  string(0) ""</p></li>
  </ul>
  
  <p>Can anyone tell me why <code>$body</code> is empty and help me fix the issue?</p>