title: PHP mailer not validating after sending a second email
body: <p>This is an updated msg's with a working code for sending two different emails using php mailer. It also has working validation server site.</p>
  
  <p>You need to create you own mail class or use the normal one.</p>
  
  <p>Hope someone else can use it two!</p>
  
  <p>Thank you!!</p>
  
  <pre><code>&lt;?php
  
  require"validation.php";
  
    ob_start();
  
    $name      = trim($_POST['name']);
    $email     = $_POST['email'];
    $comments  = $_POST['comments'];
    $info_email= 'example@example.com';
    $info_name = 'Example';
  
  
  require"PHPMailer/mail.inc.php";
  
  $cams="$name has just made a comment or posted a question";
  $camb= "&lt;html&gt; 
  
  &lt;head&gt;
  &lt;h3&gt; $name has  asked the following question or comment on you website:&lt;/h3&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  $comments &lt;br&gt;&lt;br&gt;&lt;br&gt;
  
  Their information: &lt;br&gt;&lt;br&gt;
  
  &lt;table cellspacing=\"4\" cellpadding=\"4\" border=\"1\"&gt;
  
   &lt;tr&gt;
    &lt;td align=\"center\"&gt;Name:&lt;/td&gt;
    &lt;td align=\"center\"&gt; $name&lt;/td&gt;
    &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td align=\"center\"&gt;Email:&lt;/td&gt;
    &lt;td align=\"center\"&gt; $email&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
  &lt;br&gt;
  
  &lt;img src=\"cid:mailhead\" alt=\"shop logo used in emails\"  /&gt;
  
  Pleasy try to reply as soon as possible.&lt;br&gt;
  Thank you!!
  
  &lt;/body&gt;
  &lt;/html&gt;";
  
  $mail = new MailCon;
  $mail-&gt;IsSMTP();     
  $mail-&gt;isHTML(true); 
  
  $mail-&gt;From = $email;
  $mail-&gt;FromName = $name;
  $mail-&gt;AddAddress($info_email, $info_name);
  
  $mail-&gt;Subject = $cams;
  $mail-&gt;MsgHTML($camb);
  
  if ($mail-&gt;Send()) {
  
  $mail-&gt;ClearAllRecipients(); 
    $mail-&gt;ClearReplyTos();
    $mail-&gt;ClearCustomHeaders();
  
    $cums = 'Thank you for using our contact form.';
  
  
    $message = file_get_contents('mail/example.html'); 
      $message = str_replace('%username%', $name, $message); 
      $message = str_replace('%email%', $email, $message); 
      $message = str_replace('%comments%', $comments, $message); 
  
  $alt_body="Thank you for asking us a question or making a comment. We will reply as soon as possible.";
  
    $mail = new MailCon;
    $mail-&gt;IsSMTP();
    $mail-&gt;IsHTML(true);      
  
    $mail-&gt;From = $info_email;
    $mail-&gt;FromName = $info_name;
    $mail-&gt;AddAddress($email, $name);  // Add a recipient 
  
  
  
    $mail-&gt;Subject = $cums;
    $mail-&gt;MsgHTML($message);
    $mail-&gt;AltBody = $alt_body;
    $mail-&gt;Send(); 
  
  }
  
  ob_end_flush();
  
  ?&gt;
  </code></pre>
  
  <p>This is the validation bit wich you can include using require once.</p>
  
  <pre><code> &lt;?php
  
   $name      = trim($_POST['name']);
    $email     = $_POST['email'];
    $comments  = $_POST['comments'];
  
    if (strlen($name) &lt; 2) {
  $error['name'] = "Please enter your name";  
    }
  
    if (!preg_match('/^[a-z0-9&amp;\'\.\-_\+]+@[a-z0-9\-]+\.([a-z0-9\-]+\.)*+[a-z]{2}/is',     $email)) {
  $error['email'] = "Please enter a valid email address"; 
    }
  
    if (strlen($comments) &lt; 3) {
  $error['comments'] = "Please leave a comment.";
    }
  
    if (!$error) {
  
   echo "&lt;div class='alert-box success'&gt;Thanks " . $name . ". Your message has        been sent.&lt;a href='' class='close' onclick='clearForms()'&gt;&amp;times;&lt;/a&gt;&lt;/div&gt;";
  
    } # end if no error
    else {
  
   $response = (isset($error['name'])) ? "&lt;div class='alert-box alert'&gt;" . $error['name'] . "&lt;/div&gt; \n" : null;
      $response .= (isset($error['email'])) ? "&lt;div class='alert-box alert'&gt;" . $error['email'] . "&lt;/div&gt; \n" : null;
      $response .= (isset($error['comments'])) ? "&lt;div class='alert-box alert'&gt;" . $error['comments'] . "&lt;/div&gt;" : null;
  
      echo $response;
  
    exit();
  
    } # end if there was an error sending
  
    ?&gt;
  </code></pre>