email script errors


SUBMITTED BY: phpsnippets

DATE: Oct. 21, 2015, 2 p.m.

FORMAT: Text only

SIZE: 608 Bytes

HITS: 1514

  1. <?php
  2. // Place this at the beginning of any script or place it in its own file and include it.
  3. // Change the "From" and "To" in the below code:
  4. function my_error_handler($number, $message, $file, $line, $vars){
  5. $headers = "From: noreply@example.com>\r\n";
  6. $headers .= "Content-type: text/plain; charset=utf-8\r\n";
  7. mail("me@gmail.com", "Code Errors", "Num: $number<br />\n"
  8. . "Msg: $message<br />\n"
  9. . "File: $file<br />\n"
  10. . "Line: $line<br />\n"
  11. . "var $vars", $headers);
  12. }
  13. set_error_handler('my_error_handler');
  14. // The rest of the code here

comments powered by Disqus