title: Try and Catch in phpmailer
body: <p>I have an html form. When the user press <code>sumbit</code> jQuery send a post to a php script (<strong>send.php</strong>) with the data. 
  In the <strong>send.php</strong> file I create a php object: </p>
  
  <pre><code> $mail = new PHPMailer(true);
  </code></pre>
  
  <p>Then I do a try and catch:</p>
  
  <pre><code>    try {
      $mail-&gt;IsSMTP();
  
      // ........ code for host, usr/psw, body, header ........
  
  
      $mail-&gt;Send();
  
      echo "Ok, Sent!\n";
  
      } catch (phpmailerException $e) {
        echo $e-&gt;errorMessage(); 
      }
  </code></pre>
  
  <p>It send me the mail, but I don't know where is the message <code>echo "Ok, Sent!\n";</code> ... where is it? I can't see it anywhere. Where should it be? I would like to be shown under the submit <code>button</code> , for example it could show this if the input is not correct: </p>
  
  <blockquote>
    <p>incorrect data</p>
  </blockquote>
  
  <p>this if it is sending the email</p>
  
  <blockquote>
    <p>sending mail</p>
  </blockquote>
  
  <p>this if it is correctly sent:</p>
  
  <blockquote>
    <p>Ok, Sent!</p>
  </blockquote>
  
  <p>How can I do?</p>
  
  <p><strong>UPDATE</strong>
  This is the jQuery code in the index.html page:</p>
  
  <pre><code>    $('form').submit(function() { 
  
      var event_data  = encodeURIComponent( $("#event").text() );
  
      var  formID = $(this).attr('id');
      var formDetails = $('#'+formID);
      $.ajax({
          type: "POST",
          url: 'send.php', 
          data: formDetails.serialize() + "&amp;event=" + event_data,
          success: function (data) {   
          },
          error: function(jqXHR, text, error){ 
              $('#result').html(error);           
      }
  }); 
      return false;
  });
  </code></pre>