Sending Emails on console errors in javascript
<p>Research I have done for this question and links: </p>

<p><a href="https://stackoverflow.com/questions/20253652/how-do-you-send-console-messages-and-errors-to-alert">How do you send console messages and errors to alert?</a></p>

<p><a href="https://stackoverflow.com/questions/15300470/jquery-ajax-form-using-mail-php-script-sends-email-but-post-data-from-html-fo">jQuery AJAX form using mail() PHP script sends email, but POST data from HTML form is undefined</a></p>

<p>The code example:</p>

<pre><code>function handleError(evt) {
  if (evt.message) { // Chrome sometimes provides this
 $.ajax({
            type: "POST",
            url: "email.php",
            data: evt.message,
            success: function(){
            $('.success').fadeIn(1000);
            }
        });
  } else {
    $.ajax({
            type: "POST",
            url: "email.php",
            data: evt.type,
            success: function(){
            $('.success').fadeIn(1000);
            }
        });
  }
}
</code></pre>

<p>Question) What type of validation is required in "email.php" to be sure that the emails aren't malicious (to the extent that this is possible) IE: is there a vulnerability that you are exposing yourself to with this function.
If there is a built in mechanism for changing the location of error logs in javascript, that too would answer this question. </p>